mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
feat: add "Reset to Default HTML" button
This commit is contained in:
@ -886,6 +886,18 @@ func (user *User) GetId() string {
|
||||
return fmt.Sprintf("%s/%s", user.Owner, user.Name)
|
||||
}
|
||||
|
||||
func (user *User) GetFriendlyName() string {
|
||||
if user.FirstName != "" && user.LastName != "" {
|
||||
return fmt.Sprintf("%s, %s", user.FirstName, user.LastName)
|
||||
} else if user.DisplayName != "" {
|
||||
return user.DisplayName
|
||||
} else if user.Name != "" {
|
||||
return user.Name
|
||||
} else {
|
||||
return user.Id
|
||||
}
|
||||
}
|
||||
|
||||
func isUserIdGlobalAdmin(userId string) bool {
|
||||
return strings.HasPrefix(userId, "built-in/") || strings.HasPrefix(userId, "app/")
|
||||
}
|
||||
|
@ -89,7 +89,10 @@ func SendVerificationCodeToEmail(organization *Organization, user *User, provide
|
||||
}
|
||||
|
||||
// "You have requested a verification code at Casdoor. Here is your code: %s, please enter in 5 minutes."
|
||||
content := fmt.Sprintf(provider.Content, code)
|
||||
content := strings.Replace(provider.Content, "%s", code, 1)
|
||||
if user != nil {
|
||||
content = strings.Replace(content, "%{user.friendlyName}", user.GetFriendlyName(), 1)
|
||||
}
|
||||
|
||||
if err := IsAllowSend(user, remoteAddr, provider.Category); err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user