Normal users can not search non-certified profiles

* Remove the ability for regular (non-admin) users to search the Member
  Directory for non-certified profiles.
* Profiles who don't certify can be a risk to contact, as the likelihood
  of fake pictures and scams/spam is much higher.
This commit is contained in:
Noah Petherbridge 2024-07-09 22:21:28 -07:00
parent 3203a487a5
commit 1c01aad80f
2 changed files with 10 additions and 3 deletions

View File

@ -90,6 +90,11 @@ func Search() http.HandlerFunc {
certifiedOnly = false certifiedOnly = false
} }
// Non-admin view: always hide non-certified profiles, they can be unsafe (fake profiles, scams if they won't certify)
if !currentUser.IsAdmin {
certifiedOnly = true
}
pager := &models.Pagination{ pager := &models.Pagination{
PerPage: config.PageSizeMemberSearch, PerPage: config.PageSizeMemberSearch,
Sort: sort, Sort: sort,

View File

@ -91,8 +91,10 @@
<div class="select is-fullwidth"> <div class="select is-fullwidth">
<select id="certified" name="certified" id="certified"> <select id="certified" name="certified" id="certified">
<optgroup label="Certification Status"> <optgroup label="Certification Status">
<option value="true">Only certified users</option> <option value="true">All certified members</option>
<option value="false"{{if eq $Root.Certified "false"}} selected{{end}}>Non-certified only</option> {{if .CurrentUser.IsAdmin}}
<option value="false"{{if eq $Root.Certified "false"}} selected{{end}}>☮ Non-certified only</option>
{{end}}
</optgroup> </optgroup>
<optgroup label="Profile Status"> <optgroup label="Profile Status">
<option value="shy"{{if eq $Root.Certified "shy"}} selected{{end}}>Shy Accounts</option> <option value="shy"{{if eq $Root.Certified "shy"}} selected{{end}}>Shy Accounts</option>
@ -105,9 +107,9 @@
<optgroup label="Admin Options"> <optgroup label="Admin Options">
<option value="banned"{{if eq $Root.Certified "banned"}} selected{{end}}>☮ Banned</option> <option value="banned"{{if eq $Root.Certified "banned"}} selected{{end}}>☮ Banned</option>
<option value="disabled"{{if eq $Root.Certified "disabled"}} selected{{end}}>☮ Disabled</option> <option value="disabled"{{if eq $Root.Certified "disabled"}} selected{{end}}>☮ Disabled</option>
<option value="all"{{if eq $Root.Certified "all"}} selected{{end}}>Show all users</option>
</optgroup> </optgroup>
{{end}} {{end}}
<option value="all"{{if eq $Root.Certified "all"}} selected{{end}}>Show all users</option>
</select> </select>
</div> </div>
</div> </div>