| 97 | } |
| 98 | |
| 99 | func isDefaultAdminPassword(u *v1User.User) bool { |
| 100 | if u == nil || u.Name != defaultAdminName || !u.IsAdmin { |
| 101 | return false |
| 102 | } |
| 103 | if u.Type != "" && u.Type != v1User.LOCAL { |
| 104 | return false |
| 105 | } |
| 106 | if strings.TrimSpace(u.Authenticate.Password) == "" { |
| 107 | return false |
| 108 | } |
| 109 | return bcrypt.CompareHashAndPassword([]byte(u.Authenticate.Password), []byte(defaultAdminPassword)) == nil |
| 110 | } |
| 111 | |
| 112 | func currentSessionProfile(ctx *context.Context) (UserProfile, bool) { |
| 113 | loginUser := server.SessionMgr.Start(ctx).Get("profile") |