mirror of
https://github.com/volatiletech/authboss.git
synced 2025-01-06 03:54:17 +02:00
Fix auth interruption handling.
This commit is contained in:
parent
bab0da8575
commit
7366629ab4
13
auth/auth.go
13
auth/auth.go
@ -1,7 +1,6 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
@ -75,8 +74,16 @@ func (a *AuthModule) loginHandlerFunc(ctx *authboss.Context, w http.ResponseWrit
|
||||
interrupted, err := authboss.Cfg.Callbacks.FireBefore(authboss.EventAuth, ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if interrupted {
|
||||
return errors.New("auth interrupted")
|
||||
} else if interrupted != authboss.InterruptNone {
|
||||
var reason string
|
||||
switch interrupted {
|
||||
case authboss.InterruptAccountLocked:
|
||||
reason = "Your account has been locked."
|
||||
case authboss.InterruptAccountNotConfirmed:
|
||||
reason = "Your account has not been confirmed."
|
||||
}
|
||||
render.Redirect(ctx, w, r, "/", "", reason)
|
||||
return nil
|
||||
}
|
||||
|
||||
username, _ := ctx.FirstPostFormValue("username")
|
||||
|
Loading…
Reference in New Issue
Block a user