Skip to content

Commit 32482d7

Browse files
lunnylafriks
authored andcommitted
fix bug when user login and want to resend register confirmation email (go-gitea#6482)
1 parent 3725eef commit 32482d7

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

models/login_source.go

+6-6
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ func RegisterRoutes(m *macaron.Macaron) {
339339

340340
m.Group("/user", func() {
341341
// r.Get("/feeds", binding.Bind(auth.FeedsForm{}), user.Feeds)
342-
m.Any("/activate", user.Activate)
342+
m.Any("/activate", user.Activate, reqSignIn)
343343
m.Any("/activate_email", user.ActivateEmail)
344344
m.Get("/email2user", user.Email2User)
345345
m.Get("/forgot_password", user.ForgotPasswd)

0 commit comments

Comments
 (0)