M accounts/input.go => accounts/input.go +2 -2
@@ 62,8 62,8 @@ func (l *LoginForm) Validate(c echo.Context, fetch gobwebs.UserFetch) error {
return validate.GetInputErrors([]error{err})
}
- if !user.IsVerified() {
- err = fmt.Errorf(lt.Translate("You must verify your email address before logging in"))
+ err = fetch.ProcessLogin(c, user)
+ if err != nil {
return validate.GetInputErrors([]error{err})
}
M interfaces.go => interfaces.go +6 -0
@@ 47,6 47,12 @@ type UserFetch interface {
// Helpers to customize the behavior of accounts handlers
LoginType() int
+ // Run any user checks before actually logging the user in.
+ // Ie, checking if the user has `is_verified` set to true
+ // Any error returned will raise an error in the LoginForm
+ // validation in accounts
+ ProcessLogin(c echo.Context, user User) error
+
ProcessSuccessfulLogin(c echo.Context, user User) error
ProcessSuccessfulLogout(c echo.Context) error
ProcessSuccessfulPasswordChange(c echo.Context) error