diff --git a/src/portal/src/app/account/sign-in/sign-in.component.html b/src/portal/src/app/account/sign-in/sign-in.component.html index 2342192e8..0e1a2de49 100644 --- a/src/portal/src/app/account/sign-in/sign-in.component.html +++ b/src/portal/src/app/account/sign-in/sign-in.component.html @@ -3,7 +3,7 @@
- + diff --git a/src/portal/src/app/account/sign-in/sign-in.component.scss b/src/portal/src/app/account/sign-in/sign-in.component.scss index 87fc25d66..bf5800a69 100644 --- a/src/portal/src/app/account/sign-in/sign-in.component.scss +++ b/src/portal/src/app/account/sign-in/sign-in.component.scss @@ -60,6 +60,6 @@ background:transparent; } } -.title{ - margin-bottom: 50px; +.login-oidc{ + margin-top: 50px; } \ No newline at end of file diff --git a/src/portal/src/app/account/sign-in/sign-in.component.ts b/src/portal/src/app/account/sign-in/sign-in.component.ts index 920aabb7e..bd69bd778 100644 --- a/src/portal/src/app/account/sign-in/sign-in.component.ts +++ b/src/portal/src/app/account/sign-in/sign-in.component.ts @@ -141,11 +141,12 @@ export class SignInComponent implements AfterViewChecked, OnInit { return this.appConfig.auth_mode === 'db_auth' && this.appConfig.self_registration; } - + public get isOidcLoginMode(): boolean { + return this.appConfig.auth_mode === 'oidc_auth'; + } public get showForgetPwd(): boolean { return this.appConfig.auth_mode !== 'ldap_auth' && this.appConfig.auth_mode !== 'uaa_auth'; } - clickRememberMe($event: any): void { if ($event && $event.target) { this.rememberMe = $event.target.checked; diff --git a/src/portal/src/app/base/navigator/navigator.component.ts b/src/portal/src/app/base/navigator/navigator.component.ts index 399627e2e..c03a815dd 100644 --- a/src/portal/src/app/base/navigator/navigator.component.ts +++ b/src/portal/src/app/base/navigator/navigator.component.ts @@ -14,7 +14,8 @@ import { Component, Output, EventEmitter, OnInit } from '@angular/core'; import { Router, NavigationExtras } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; - +// import { map } from 'rxjs/operators'; +import { PlatformLocation } from '@angular/common'; import { ModalEvent } from '../modal-event'; import { modalEvents } from '../modal-events.const'; @@ -25,7 +26,7 @@ import { supportedLangs, enLang, languageNames, CommonRoutes } from '../../share import { AppConfigService } from '../../app-config.service'; import { SearchTriggerService } from '../global-search/search-trigger.service'; import { MessageHandlerService } from '../../shared/message-handler/message-handler.service'; -import {SkinableConfig} from "../../skinable-config.service"; +import { SkinableConfig } from "../../skinable-config.service"; @Component({ selector: 'navigator', @@ -40,12 +41,13 @@ export class NavigatorComponent implements OnInit { selectedLang: string = enLang; appTitle: string = 'APP_TITLE.HARBOR'; - customStyle: {[key: string]: any}; - customProjectName: {[key: string]: any}; + customStyle: { [key: string]: any }; + customProjectName: { [key: string]: any }; constructor( private session: SessionService, private router: Router, + private location: PlatformLocation, private translate: TranslateService, private cookie: CookieService, private appConfigService: AppConfigService, @@ -65,10 +67,10 @@ export class NavigatorComponent implements OnInit { } this.selectedLang = this.translate.currentLang; - this.translate.onLangChange.subscribe((langChange: {lang: string}) => { + this.translate.onLangChange.subscribe((langChange: { lang: string }) => { this.selectedLang = langChange.lang; // Keep in cookie for next use - let opt: CookieOptions = {path: '/', expires: new Date(Date.now() + 3600 * 1000 * 24 * 31)}; + let opt: CookieOptions = { path: '/', expires: new Date(Date.now() + 3600 * 1000 * 24 * 31) }; this.cookie.put("harbor-lang", langChange.lang, opt); }); if (this.appConfigService.isIntegrationMode()) { @@ -112,7 +114,7 @@ export class NavigatorComponent implements OnInit { let config = this.appConfigService.getConfig(); return user && ((config && !(config.auth_mode === "ldap_auth" || config.auth_mode === "uaa_auth")) || - (user.user_id === 1 && user.username === "admin")); + (user.user_id === 1 && user.username === "admin")); } matchLang(lang: string): boolean { @@ -147,8 +149,10 @@ export class NavigatorComponent implements OnInit { logOut(): void { // Naviagte to the sign in route // Appending 'signout' means destroy session cache + let signout = true; + let redirect_url = this.location.pathname; let navigatorExtra: NavigationExtras = { - queryParams: { "signout": true } + queryParams: {signout, redirect_url} }; this.router.navigate([CommonRoutes.EMBEDDED_SIGN_IN], navigatorExtra); // Confirm search result panel is close diff --git a/src/portal/src/app/oidc-onboard/oidc-onboard.component.ts b/src/portal/src/app/oidc-onboard/oidc-onboard.component.ts index 8b32a4297..beae8b6a8 100644 --- a/src/portal/src/app/oidc-onboard/oidc-onboard.component.ts +++ b/src/portal/src/app/oidc-onboard/oidc-onboard.component.ts @@ -28,7 +28,9 @@ export class OidcOnboardComponent implements OnInit { }); } clickSaveBtn(): void { - this.oidcOnboardService.oidcSave({ username: this.oidcUsername.value }).subscribe(res => { } + this.oidcOnboardService.oidcSave({ username: this.oidcUsername.value }).subscribe(res => { + this.router.navigate([CommonRoutes.HARBOR_DEFAULT]); + } , error => { this.errorMessage = errorHandler(error); this.errorOpen = true;