From 3b28de7d8eff9d9500e6db5c8db7c16e5b731c7f Mon Sep 17 00:00:00 2001 From: Lauris BH Date: Tue, 2 Apr 2019 11:36:56 +0300 Subject: [PATCH] fix bug when user login and want to resend register confirmation email (#6482) (#6486) --- models/login_source.go | 12 ++++++------ routers/routes/routes.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/models/login_source.go b/models/login_source.go index b481cb4db..69602b8b1 100644 --- a/models/login_source.go +++ b/models/login_source.go @@ -616,9 +616,9 @@ func ExternalUserLogin(user *User, login, password string, source *LoginSource, return nil, err } - if !user.IsActive { - return nil, ErrUserInactive{user.ID, user.Name} - } else if user.ProhibitLogin { + // WARN: DON'T check user.IsActive, that will be checked on reqSign so that + // user could be hint to resend confirm email. + if user.ProhibitLogin { return nil, ErrUserProhibitLogin{user.ID, user.Name} } @@ -658,9 +658,9 @@ func UserSignIn(username, password string) (*User, error) { switch user.LoginType { case LoginNoType, LoginPlain, LoginOAuth2: if user.IsPasswordSet() && user.ValidatePassword(password) { - if !user.IsActive { - return nil, ErrUserInactive{user.ID, user.Name} - } else if user.ProhibitLogin { + // WARN: DON'T check user.IsActive, that will be checked on reqSign so that + // user could be hint to resend confirm email. + if user.ProhibitLogin { return nil, ErrUserProhibitLogin{user.ID, user.Name} } diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 5f55d6cf9..cdba1b7d9 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -339,7 +339,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Group("/user", func() { // r.Get("/feeds", binding.Bind(auth.FeedsForm{}), user.Feeds) - m.Any("/activate", user.Activate) + m.Any("/activate", user.Activate, reqSignIn) m.Any("/activate_email", user.ActivateEmail) m.Get("/email2user", user.Email2User) m.Get("/forgot_password", user.ForgotPasswd)