1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-24 08:57:03 -05:00

fix bug when user login and want to resend register confirmation email (#6482)

This commit is contained in:
Lunny Xiao 2019-04-02 13:44:33 +08:00 committed by Lauris BH
parent b04a1d9d63
commit ef2a343e27
2 changed files with 7 additions and 7 deletions

View file

@ -616,9 +616,9 @@ func ExternalUserLogin(user *User, login, password string, source *LoginSource,
return nil, err return nil, err
} }
if !user.IsActive { // WARN: DON'T check user.IsActive, that will be checked on reqSign so that
return nil, ErrUserInactive{user.ID, user.Name} // user could be hint to resend confirm email.
} else if user.ProhibitLogin { if user.ProhibitLogin {
return nil, ErrUserProhibitLogin{user.ID, user.Name} return nil, ErrUserProhibitLogin{user.ID, user.Name}
} }
@ -658,9 +658,9 @@ func UserSignIn(username, password string) (*User, error) {
switch user.LoginType { switch user.LoginType {
case LoginNoType, LoginPlain, LoginOAuth2: case LoginNoType, LoginPlain, LoginOAuth2:
if user.IsPasswordSet() && user.ValidatePassword(password) { if user.IsPasswordSet() && user.ValidatePassword(password) {
if !user.IsActive { // WARN: DON'T check user.IsActive, that will be checked on reqSign so that
return nil, ErrUserInactive{user.ID, user.Name} // user could be hint to resend confirm email.
} else if user.ProhibitLogin { if user.ProhibitLogin {
return nil, ErrUserProhibitLogin{user.ID, user.Name} return nil, ErrUserProhibitLogin{user.ID, user.Name}
} }

View file

@ -339,7 +339,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Group("/user", func() { m.Group("/user", func() {
// r.Get("/feeds", binding.Bind(auth.FeedsForm{}), user.Feeds) // 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.Any("/activate_email", user.ActivateEmail)
m.Get("/email2user", user.Email2User) m.Get("/email2user", user.Email2User)
m.Get("/forgot_password", user.ForgotPasswd) m.Get("/forgot_password", user.ForgotPasswd)