Skip to content

Commit

Permalink
fix bug when user login and want to resend register confirmation email (
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored and lafriks committed Apr 2, 2019
1 parent b04a1d9 commit ef2a343
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions models/login_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}

Expand Down Expand Up @@ -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}
}

Expand Down
2 changes: 1 addition & 1 deletion routers/routes/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ef2a343

Please sign in to comment.