Replaced relogin rejection with a notice and proper redirect.
This commit is contained in:
parent
e74b18967e
commit
c76ea45ca9
|
@ -9415,6 +9415,10 @@ span.icon-rss::before {
|
|||
background-color: #43a52f;
|
||||
background-color: var(--notice-success-color); }
|
||||
|
||||
.notice-warn {
|
||||
background-color: #aa7d30;
|
||||
background-color: var(--notice-warn-color); }
|
||||
|
||||
.notice-failure {
|
||||
background-color: #b42222;
|
||||
background-color: var(--notice-failure-color); }
|
||||
|
|
|
@ -244,6 +244,7 @@ pre, code, .codeblock {
|
|||
--notice-lts-color: #2a681d;
|
||||
--notice-lts-reqd-color: #876327;
|
||||
--notice-success-color: #2a681d;
|
||||
--notice-warn-color: #876327;
|
||||
--notice-failure-color: #7a2020;
|
||||
--optionbar-border-color: #333;
|
||||
--tab-background: #181818;
|
||||
|
|
|
@ -262,6 +262,7 @@ pre, code, .codeblock {
|
|||
--notice-lts-color: #43a52f;
|
||||
--notice-lts-reqd-color: #aa7d30;
|
||||
--notice-success-color: #43a52f;
|
||||
--notice-warn-color: #aa7d30;
|
||||
--notice-failure-color: #b42222;
|
||||
--optionbar-border-color: #ccc;
|
||||
--tab-background: #fff;
|
||||
|
|
|
@ -36,6 +36,10 @@
|
|||
@include usevar(background-color, notice-success-color);
|
||||
}
|
||||
|
||||
.notice-warn {
|
||||
@include usevar(background-color, notice-warn-color);
|
||||
}
|
||||
|
||||
.notice-failure {
|
||||
@include usevar(background-color, notice-failure-color);
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ $vars: (
|
|||
notice-lts-color: #2a681d,
|
||||
notice-lts-reqd-color: #876327,
|
||||
notice-success-color: #2a681d,
|
||||
notice-warn-color: #876327,
|
||||
notice-failure-color: #7a2020,
|
||||
|
||||
optionbar-border-color: #333,
|
||||
|
|
|
@ -46,6 +46,7 @@ $vars: (
|
|||
notice-lts-color: #43a52f,
|
||||
notice-lts-reqd-color: #aa7d30,
|
||||
notice-success-color: #43a52f,
|
||||
notice-warn-color: #aa7d30,
|
||||
notice-failure-color: #b42222,
|
||||
|
||||
optionbar-border-color: #ccc,
|
||||
|
|
|
@ -41,10 +41,6 @@ func LoginPage(c *RequestContext) ResponseData {
|
|||
}
|
||||
|
||||
func Login(c *RequestContext) ResponseData {
|
||||
if c.CurrentUser != nil {
|
||||
return RejectRequest(c, "You are already logged in.")
|
||||
}
|
||||
|
||||
form, err := c.GetFormValues()
|
||||
if err != nil {
|
||||
return c.ErrorResponse(http.StatusBadRequest, NewSafeError(err, "request must contain form data"))
|
||||
|
@ -55,6 +51,12 @@ func Login(c *RequestContext) ResponseData {
|
|||
redirect = "/"
|
||||
}
|
||||
|
||||
if c.CurrentUser != nil {
|
||||
res := c.Redirect(redirect, http.StatusSeeOther)
|
||||
res.AddFutureNotice("warn", fmt.Sprintf("You are already logged in as %s.", c.CurrentUser.Username))
|
||||
return res
|
||||
}
|
||||
|
||||
username := form.Get("username")
|
||||
password := form.Get("password")
|
||||
if username == "" || password == "" {
|
||||
|
|
Loading…
Reference in New Issue