Change the encrypted password dialog to use the user's external username, if one exists.
Fixes #1538
This commit is contained in:
parent
f36442aa0d
commit
4b3420eddf
3 changed files with 33 additions and 6 deletions
|
@ -17,6 +17,7 @@ function(ApiService, CookieService, $rootScope, Config) {
|
|||
}
|
||||
|
||||
var userService = {}
|
||||
var _EXTERNAL_SERVICES = ['ldap', 'jwtauthn', 'keystone', 'dex'];
|
||||
|
||||
userService.hasEverLoggedIn = function() {
|
||||
return CookieService.get('quay.loggedin') == 'true';
|
||||
|
@ -147,6 +148,21 @@ function(ApiService, CookieService, $rootScope, Config) {
|
|||
return null;
|
||||
};
|
||||
|
||||
userService.getCLIUsername = function() {
|
||||
if (!userResponse) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var externalUsername = null;
|
||||
userResponse.logins.forEach(function(login) {
|
||||
if (_EXTERNAL_SERVICES.indexOf(login.service) >= 0) {
|
||||
externalUsername = login.service_identifier;
|
||||
}
|
||||
});
|
||||
|
||||
return externalUsername || userResponse.username;
|
||||
};
|
||||
|
||||
userService.currentUser = function() {
|
||||
return userResponse;
|
||||
};
|
||||
|
|
Reference in a new issue