Add proper ban page when logging in (#773)

* Add proper ban page upon logging in

* Remove two extra line break tags that don't need to be there

* Fix timestamp formatting

* Properly display timestamps in correct timezone

* Fix formatting issues with ban page

* Remove extra parenthesis which would be rendered on-page

* Add to redirect middleware to prevent navigating to other pages

* Small nitpick, renaming UserBannedPage to BannedUserPage

* Resolve nitpicks from reviewers

* Remove un-necessary log message in LoginForm

* Fix ban reason translatable string argument

* Word choice nitpick ("Ban Created" -> "Ban Issued")

* Final adjustments and nitpicks, visual and grammatical

* Resolve requested changes from reviewers
This commit is contained in:
koko 2023-05-30 15:25:31 -04:00 committed by GitHub
commit 21dbdff20a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 203 additions and 23 deletions

View file

@ -59,6 +59,18 @@ public class UserRequiredRedirectMiddleware : MiddlewareDBContext
return;
}
if (user.IsBanned)
{
if (!pathContains(ctx, "/banned"))
{
ctx.Response.Redirect("/banned");
return;
}
await this.next(ctx);
return;
}
if (user.EmailAddress == null && ServerConfiguration.Instance.Mail.MailEnabled)
{
if (!pathContains(ctx, "/login/setEmail"))