Log out user after setting status to 'banned'
This commit is contained in:
parent
83ef51374d
commit
12eb172f98
|
@ -481,6 +481,12 @@ func UserProfileAdminSetStatus(c *RequestContext) ResponseData {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to update user status"))
|
return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to update user status"))
|
||||||
}
|
}
|
||||||
|
if desiredStatus == models.UserStatusBanned {
|
||||||
|
err = auth.DeleteSessionForUser(c.Context(), c.Conn, c.Req.Form.Get("username"))
|
||||||
|
if err != nil {
|
||||||
|
return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to log out user"))
|
||||||
|
}
|
||||||
|
}
|
||||||
res := c.Redirect(hmnurl.BuildUserProfile(c.Req.Form.Get("username")), http.StatusSeeOther)
|
res := c.Redirect(hmnurl.BuildUserProfile(c.Req.Form.Get("username")), http.StatusSeeOther)
|
||||||
res.AddFutureNotice("success", "Successfully set status")
|
res.AddFutureNotice("success", "Successfully set status")
|
||||||
return res
|
return res
|
||||||
|
|
Loading…
Reference in New Issue