Bugfixes around banned user accounts
This commit is contained in:
parent
0cdfcbb976
commit
df65b1b260
|
@ -46,7 +46,7 @@ func UserPhotos() http.HandlerFunc {
|
||||||
var (
|
var (
|
||||||
isOwnPhotos = currentUser.ID == user.ID
|
isOwnPhotos = currentUser.ID == user.ID
|
||||||
isShy = currentUser.IsShy()
|
isShy = currentUser.IsShy()
|
||||||
isShyFrom = currentUser.IsShyFrom(user) || (isShy && !models.AreFriends(currentUser.ID, user.ID))
|
isShyFrom = !isOwnPhotos && (currentUser.IsShyFrom(user) || (isShy && !models.AreFriends(currentUser.ID, user.ID)))
|
||||||
)
|
)
|
||||||
|
|
||||||
// Bail early if we are shy from this user.
|
// Bail early if we are shy from this user.
|
||||||
|
|
|
@ -95,6 +95,19 @@ func CertRequired(handler http.Handler) http.Handler {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Are they banned or disabled?
|
||||||
|
if currentUser.Status == models.UserStatusDisabled {
|
||||||
|
session.LogoutUser(w, r)
|
||||||
|
session.FlashError(w, r, "Your account has been disabled and you are now logged out.")
|
||||||
|
templates.Redirect(w, "/")
|
||||||
|
return
|
||||||
|
} else if currentUser.Status == models.UserStatusBanned {
|
||||||
|
session.LogoutUser(w, r)
|
||||||
|
session.FlashError(w, r, "Your account has been banned and you are now logged out.")
|
||||||
|
templates.Redirect(w, "/")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// User must be certified.
|
// User must be certified.
|
||||||
if !currentUser.Certified || currentUser.ProfilePhoto.ID == 0 {
|
if !currentUser.Certified || currentUser.ProfilePhoto.ID == 0 {
|
||||||
log.Error("CertRequired: user is not certified")
|
log.Error("CertRequired: user is not certified")
|
||||||
|
|
|
@ -245,8 +245,8 @@ func SearchUsers(user *User, search *UserSearch, pager *Pagination) ([]*User, er
|
||||||
}
|
}
|
||||||
|
|
||||||
if search.Certified {
|
if search.Certified {
|
||||||
wheres = append(wheres, "certified = ?")
|
wheres = append(wheres, "certified = ?", "status = ?")
|
||||||
placeholders = append(placeholders, search.Certified)
|
placeholders = append(placeholders, search.Certified, UserStatusActive)
|
||||||
}
|
}
|
||||||
|
|
||||||
if search.AgeMin > 0 {
|
if search.AgeMin > 0 {
|
||||||
|
|
|
@ -184,7 +184,11 @@
|
||||||
<div class="media-content">
|
<div class="media-content">
|
||||||
<p class="title is-4">
|
<p class="title is-4">
|
||||||
<a href="/u/{{.Username}}" class="has-text-dark">
|
<a href="/u/{{.Username}}" class="has-text-dark">
|
||||||
{{.NameOrUsername}}
|
{{if ne .Status "active"}}
|
||||||
|
<del>{{.NameOrUsername}}</del>
|
||||||
|
{{else}}
|
||||||
|
{{.NameOrUsername}}
|
||||||
|
{{end}}
|
||||||
</a>
|
</a>
|
||||||
{{if eq .Visibility "private"}}
|
{{if eq .Visibility "private"}}
|
||||||
<sup class="fa fa-mask is-size-7" title="Private Profile"></sup>
|
<sup class="fa fa-mask is-size-7" title="Private Profile"></sup>
|
||||||
|
@ -200,6 +204,9 @@
|
||||||
</span>
|
</span>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
<!-- "(banned)" label -->
|
||||||
|
{{if ne .Status "active"}}<small>({{.Status}})</small>{{end}}
|
||||||
|
|
||||||
{{if .IsAdmin}}
|
{{if .IsAdmin}}
|
||||||
<span class="has-text-danger">
|
<span class="has-text-danger">
|
||||||
<span class="icon"><i class="fa fa-gavel"></i></span>
|
<span class="icon"><i class="fa fa-gavel"></i></span>
|
||||||
|
|
|
@ -88,7 +88,13 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="media-content">
|
<div class="media-content">
|
||||||
<p class="title is-4">
|
<p class="title is-4">
|
||||||
<a href="/u/{{.Username}}" class="has-text-dark">{{.NameOrUsername}}</a>
|
<a href="/u/{{.Username}}" class="has-text-dark">
|
||||||
|
{{if ne .Status "active"}}
|
||||||
|
<del>{{.NameOrUsername}}</del>
|
||||||
|
{{else}}
|
||||||
|
{{.NameOrUsername}}
|
||||||
|
{{end}}
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p class="subtitle is-6">
|
<p class="subtitle is-6">
|
||||||
<span class="icon"><i class="fa fa-user"></i></span>
|
<span class="icon"><i class="fa fa-user"></i></span>
|
||||||
|
@ -100,6 +106,9 @@
|
||||||
</span>
|
</span>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
<!-- "(banned)" label -->
|
||||||
|
{{if ne .Status "active"}}<small>({{.Status}})</small>{{end}}
|
||||||
|
|
||||||
{{if .IsAdmin}}
|
{{if .IsAdmin}}
|
||||||
<span class="has-text-danger">
|
<span class="has-text-danger">
|
||||||
<span class="icon"><i class="fa fa-gavel"></i></span>
|
<span class="icon"><i class="fa fa-gavel"></i></span>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user