File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -24,17 +24,18 @@ import (
24
24
func UserSignIn (username , password string ) (* user_model.User , * auth.Source , error ) {
25
25
var user * user_model.User
26
26
if strings .Contains (username , "@" ) {
27
- user = & user_model.User {Email : strings .ToLower (strings .TrimSpace (username ))}
27
+ emailAddress := user_model.EmailAddress {Email : strings .ToLower (strings .TrimSpace (username ))}
28
28
// check same email
29
- cnt , err := db .Count ( user )
29
+ has , err := db .GetEngine ( db . DefaultContext ). Where ( "is_activated=?" , true ). Get ( & emailAddress )
30
30
if err != nil {
31
31
return nil , nil , err
32
32
}
33
- if cnt > 1 {
34
- return nil , nil , user_model.ErrEmailAlreadyUsed {
33
+ if ! has {
34
+ return nil , nil , user_model.ErrEmailAddressNotExist {
35
35
Email : user .Email ,
36
36
}
37
37
}
38
+ user = & user_model.User {ID : emailAddress .UID }
38
39
} else {
39
40
trimmedUsername := strings .TrimSpace (username )
40
41
if len (trimmedUsername ) == 0 {
You can’t perform that action at this time.
0 commit comments