From 94438608a7e82915b07eacde8947173de0f92bb9 Mon Sep 17 00:00:00 2001 From: Yogi_Wang Date: Thu, 11 Apr 2019 12:47:58 +0800 Subject: [PATCH] Add Cli secret in Harbor user profile user could copy the CLI secret when login through oidc, and using this cli secret as password when using docker/helm cli to access Harbor. Signed-off-by: Yogi_Wang --- .../account-settings-modal.component.html | 13 +++++++++++++ .../account-settings-modal.component.scss | 3 +++ .../account-settings-modal.component.ts | 9 ++++++++- src/portal/src/app/shared/session-user.ts | 9 +++++++++ src/portal/src/i18n/lang/en-us-lang.json | 6 +++++- src/portal/src/i18n/lang/es-es-lang.json | 6 +++++- src/portal/src/i18n/lang/fr-fr-lang.json | 6 +++++- src/portal/src/i18n/lang/pt-br-lang.json | 6 +++++- src/portal/src/i18n/lang/zh-cn-lang.json | 6 +++++- 9 files changed, 58 insertions(+), 6 deletions(-) diff --git a/src/portal/src/app/account/account-settings/account-settings-modal.component.html b/src/portal/src/app/account/account-settings/account-settings-modal.component.html index b4d4a6d92..f9a32e790 100644 --- a/src/portal/src/app/account/account-settings/account-settings-modal.component.html +++ b/src/portal/src/app/account/account-settings/account-settings-modal.component.html @@ -51,6 +51,19 @@ +
+ + +
+ +
+
diff --git a/src/portal/src/app/account/account-settings/account-settings-modal.component.scss b/src/portal/src/app/account/account-settings/account-settings-modal.component.scss index ee71c0347..c0ea6022d 100644 --- a/src/portal/src/app/account/account-settings/account-settings-modal.component.scss +++ b/src/portal/src/app/account/account-settings/account-settings-modal.component.scss @@ -11,4 +11,7 @@ clr-modal { position: relative; bottom: 9px; } + .label-inner-text{ + margin: 0; + } } \ No newline at end of file diff --git a/src/portal/src/app/account/account-settings/account-settings-modal.component.ts b/src/portal/src/app/account/account-settings/account-settings-modal.component.ts index 0bdb211fb..2f81b64ed 100644 --- a/src/portal/src/app/account/account-settings/account-settings-modal.component.ts +++ b/src/portal/src/app/account/account-settings/account-settings-modal.component.ts @@ -22,7 +22,7 @@ import { InlineAlertComponent } from "../../shared/inline-alert/inline-alert.com import { MessageHandlerService } from "../../shared/message-handler/message-handler.service"; import { SearchTriggerService } from "../../base/global-search/search-trigger.service"; import { CommonRoutes } from "../../shared/shared.const"; - +import { CopyInputComponent } from "@harbor/ui"; @Component({ selector: "account-settings-modal", templateUrl: "account-settings-modal.component.html", @@ -48,6 +48,7 @@ export class AccountSettingsModalComponent implements OnInit, AfterViewChecked { accountFormRef: NgForm; @ViewChild("accountSettingsFrom") accountForm: NgForm; @ViewChild(InlineAlertComponent) inlineAlert: InlineAlertComponent; + @ViewChild("copyInput") copyInput: CopyInputComponent; constructor( private session: SessionService, @@ -320,4 +321,10 @@ export class AccountSettingsModalComponent implements OnInit, AfterViewChecked { this.inlineAlert.close(); this.opened = false; } + onSuccess(event) { + this.inlineAlert.showInlineSuccess({message: 'PROFILE.COPY_SUCCESS'}); + } + onError(event) { + this.inlineAlert.showInlineError({message: 'PROFILE.COPY_ERROR'}); + } } diff --git a/src/portal/src/app/shared/session-user.ts b/src/portal/src/app/shared/session-user.ts index 09e488ff8..cc762673f 100644 --- a/src/portal/src/app/shared/session-user.ts +++ b/src/portal/src/app/shared/session-user.ts @@ -21,4 +21,13 @@ export class SessionUser { role_id?: number; has_admin_role?: boolean; comment: string; + oidc_user_meta?: OidcUserMeta; +} +export class OidcUserMeta { + id: number; + user_id: number; + secret: string; + subiss: string; + creation_time: Date; + update_time: Date; } diff --git a/src/portal/src/i18n/lang/en-us-lang.json b/src/portal/src/i18n/lang/en-us-lang.json index 3f75b56d5..b19793a6d 100644 --- a/src/portal/src/i18n/lang/en-us-lang.json +++ b/src/portal/src/i18n/lang/en-us-lang.json @@ -101,7 +101,11 @@ "ADMIN_RENAME_BUTTON": "Change username", "ADMIN_RENAME_TIP": "Select the button in order to change the username to \"admin@harbor.local\". This operation can not be undone.", "RENAME_SUCCESS": "Rename success!", - "RENAME_CONFIRM_INFO": "Warning, changing the name to admin@harbor.local can not be undone." + "RENAME_CONFIRM_INFO": "Warning, changing the name to admin@harbor.local can not be undone.", + "CLI_PASSWORD": "CLI secret", + "CLI_PASSWORD_TIP": "You can use this cli secret as password when using docker/helm cli to access Harbor.", + "COPY_SUCCESS": "copy success", + "COPY_ERROR": "copy failed" }, "CHANGE_PWD": { "TITLE": "Change Password", diff --git a/src/portal/src/i18n/lang/es-es-lang.json b/src/portal/src/i18n/lang/es-es-lang.json index 633524653..cab7975c5 100644 --- a/src/portal/src/i18n/lang/es-es-lang.json +++ b/src/portal/src/i18n/lang/es-es-lang.json @@ -101,7 +101,11 @@ "ADMIN_RENAME_BUTTON": "Change username", "ADMIN_RENAME_TIP": "Select the button in order to change the username to \"admin@harbor.local\". This operation can not be undone.", "RENAME_SUCCESS": "Rename success!", - "RENAME_CONFIRM_INFO": "Warning, changing the name to admin@harbor.local can not be undone." + "RENAME_CONFIRM_INFO": "Warning, changing the name to admin@harbor.local can not be undone.", + "CLI_PASSWORD": "CLI secreto", + "CLI_PASSWORD_TIP": "Puede utilizar este generador CLI secreto como utilizando Docker / Helm CLI para acceder a puerto.", + "COPY_SUCCESS": "Copiar el éxito", + "COPY_ERROR": "Copia no" }, "CHANGE_PWD": { "TITLE": "Cambiar contraseña", diff --git a/src/portal/src/i18n/lang/fr-fr-lang.json b/src/portal/src/i18n/lang/fr-fr-lang.json index 6a50cab24..bed0f2d58 100644 --- a/src/portal/src/i18n/lang/fr-fr-lang.json +++ b/src/portal/src/i18n/lang/fr-fr-lang.json @@ -88,7 +88,11 @@ "ADMIN_RENAME_BUTTON": "Change username", "ADMIN_RENAME_TIP": "Select the button in order to change the username to \"admin@harbor.local\". This operation can not be undone.", "RENAME_SUCCESS": "Rename success!", - "RENAME_CONFIRM_INFO": "Warning, changing the name to admin@harbor.local can not be undone." + "RENAME_CONFIRM_INFO": "Warning, changing the name to admin@harbor.local can not be undone.", + "CLI_PASSWORD": "CLI secret", + "CLI_PASSWORD_TIP": "vous pouvez utiliser ce cli secret comme mot de passe quand utiliser docker / barre l'accès à harbor.", + "COPY_SUCCESS": "copie de succès", + "COPY_ERROR": "copie a échoué" }, "CHANGE_PWD": { "TITLE": "Modifier le mot de passe", diff --git a/src/portal/src/i18n/lang/pt-br-lang.json b/src/portal/src/i18n/lang/pt-br-lang.json index 0ca3e6f01..15cbbd870 100644 --- a/src/portal/src/i18n/lang/pt-br-lang.json +++ b/src/portal/src/i18n/lang/pt-br-lang.json @@ -99,7 +99,11 @@ "ADMIN_RENAME_BUTTON": "Alterar nome de usuário", "ADMIN_RENAME_TIP": "Selecione o botão para alterar o nome de usuário para \"admin@harbor.local\". Essa operação não pode ser desfeita.", "RENAME_SUCCESS": "Renomeado com sucesso!", - "RENAME_CONFIRM_INFO": "Atenção, alterar o nome para admin@harbor.local não pode ser desfeito." + "RENAME_CONFIRM_INFO": "Atenção, alterar o nome para admin@harbor.local não pode ser desfeito.", + "CLI_PASSWORD": "Segredo CLI", + "CLI_PASSWORD_TIP": "Você Pode USAR este Segredo de clitóris Como senha Ao USAR clitóris de estivador /leme para acessar Harbor.", + "COPY_SUCCESS": "SUCESSO de cópia", + "COPY_ERROR": "Cópia falhou" }, "CHANGE_PWD": { "TITLE": "Alterar Senha", diff --git a/src/portal/src/i18n/lang/zh-cn-lang.json b/src/portal/src/i18n/lang/zh-cn-lang.json index f4f3c3556..668c09264 100644 --- a/src/portal/src/i18n/lang/zh-cn-lang.json +++ b/src/portal/src/i18n/lang/zh-cn-lang.json @@ -100,7 +100,11 @@ "ADMIN_RENAME_TIP": "单击将用户名改为 \"admin@harbor.local\", 注意这个操作是无法撤销的", "RENAME_SUCCESS": "用户名更改成功!", "ADMIN_RENAME_BUTTON": "更改用户名", - "RENAME_CONFIRM_INFO": "更改用户名为admin@harbor.local是无法撤销的, 你确定更改吗?" + "RENAME_CONFIRM_INFO": "更改用户名为admin@harbor.local是无法撤销的, 你确定更改吗?", + "CLI_PASSWORD": "CLI密码", + "CLI_PASSWORD_TIP": "使用docker/helm cli访问Harbor时,可以使用此cli密码作为密码。", + "COPY_SUCCESS": "复制成功", + "COPY_ERROR": "复制失败" }, "CHANGE_PWD": { "TITLE": "修改密码",