Skip to content

Commit 4ff6eff

Browse files
lafrikstechknowlogick
authored andcommitted
fix bug when user login and want to resend register confirmation email (#6482) (#6487)
1 parent 84a5b81 commit 4ff6eff

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

models/login_source.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -616,9 +616,9 @@ func ExternalUserLogin(user *User, login, password string, source *LoginSource,
616616
return nil, err
617617
}
618618

619-
if !user.IsActive {
620-
return nil, ErrUserInactive{user.ID, user.Name}
621-
} else if user.ProhibitLogin {
619+
// WARN: DON'T check user.IsActive, that will be checked on reqSign so that
620+
// user could be hint to resend confirm email.
621+
if user.ProhibitLogin {
622622
return nil, ErrUserProhibitLogin{user.ID, user.Name}
623623
}
624624

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

routers/routes/routes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ func RegisterRoutes(m *macaron.Macaron) {
296296

297297
m.Group("/user", func() {
298298
// r.Get("/feeds", binding.Bind(auth.FeedsForm{}), user.Feeds)
299-
m.Any("/activate", user.Activate)
299+
m.Any("/activate", user.Activate, reqSignIn)
300300
m.Any("/activate_email", user.ActivateEmail)
301301
m.Get("/email2user", user.Email2User)
302302
m.Get("/forgot_password", user.ForgotPasswd)

0 commit comments

Comments
 (0)