|
|
@@ -145,7 +145,7 @@ type User struct { |
|
|
|
AllowImportLocal bool // Allow migrate repository by local path |
|
|
|
AllowCreateOrganization bool `xorm:"DEFAULT true"` |
|
|
|
ProhibitLogin bool `xorm:"NOT NULL DEFAULT false"` |
|
|
|
IsOperator bool `xorm:"NOT NULL DEFAULT false"` //运营人员 |
|
|
|
IsOperator bool `xorm:"NOT NULL DEFAULT false"` //运营人员 |
|
|
|
|
|
|
|
// Avatar |
|
|
|
Avatar string `xorm:"VARCHAR(2048) NOT NULL"` |
|
|
@@ -929,6 +929,15 @@ var ( |
|
|
|
"template", |
|
|
|
"user", |
|
|
|
"vendor", |
|
|
|
"dashbord", |
|
|
|
"operation", |
|
|
|
"blockchain", |
|
|
|
"avatar", |
|
|
|
"swagger.v1.json", |
|
|
|
"secure", |
|
|
|
"serviceworker.js", |
|
|
|
"self", |
|
|
|
"repo-avatars", |
|
|
|
} |
|
|
|
reservedUserPatterns = []string{"*.keys", "*.gpg"} |
|
|
|
) |
|
|
@@ -1552,11 +1561,11 @@ func GetUserByActivateEmail(email string) (*User, error) { |
|
|
|
if err := ctx.e.Join("INNER", "email_address", "email_address.uid = \"user\".id"). |
|
|
|
Where("email_address.email= ?", email). |
|
|
|
Find(&users); err != nil { |
|
|
|
return nil,err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
if len(users) >= 1 { |
|
|
|
return &users[0],nil |
|
|
|
}else { |
|
|
|
return &users[0], nil |
|
|
|
} else { |
|
|
|
// Finally, if email address is the protected email address:用户邮件地址设置为隐藏电子邮件地址 |
|
|
|
if strings.HasSuffix(email, fmt.Sprintf("@%s", setting.Service.NoReplyAddress)) { |
|
|
|
username := strings.TrimSuffix(email, fmt.Sprintf("@%s", setting.Service.NoReplyAddress)) |
|
|
@@ -1572,6 +1581,7 @@ func GetUserByActivateEmail(email string) (*User, error) { |
|
|
|
return nil, errors.New("cannot find user by email") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// GetUserByEmail returns the user object by given e-mail if exists. |
|
|
|
func GetUserByEmail(email string) (*User, error) { |
|
|
|
return GetUserByEmailContext(DefaultDBContext(), email) |
|
|
|