mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-18 21:01:27 +01:00
Change the login module
change the login module to fix the issue that the nav is being in page when we login harbor again Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
parent
a8ff6aa934
commit
5df1542c22
@ -18,7 +18,6 @@ import { CoreModule } from '../core/core.module';
|
|||||||
import { SharedModule } from '../shared/shared.module';
|
import { SharedModule } from '../shared/shared.module';
|
||||||
import { RepositoryModule } from '../repository/repository.module';
|
import { RepositoryModule } from '../repository/repository.module';
|
||||||
|
|
||||||
import { SignInComponent } from './sign-in/sign-in.component';
|
|
||||||
import { PasswordSettingComponent } from './password-setting/password-setting.component';
|
import { PasswordSettingComponent } from './password-setting/password-setting.component';
|
||||||
import { AccountSettingsModalComponent } from './account-settings/account-settings-modal.component';
|
import { AccountSettingsModalComponent } from './account-settings/account-settings-modal.component';
|
||||||
import { SignUpComponent } from './sign-up/sign-up.component';
|
import { SignUpComponent } from './sign-up/sign-up.component';
|
||||||
@ -36,7 +35,6 @@ import { PasswordSettingService } from './password-setting/password-setting.serv
|
|||||||
RepositoryModule
|
RepositoryModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
SignInComponent,
|
|
||||||
PasswordSettingComponent,
|
PasswordSettingComponent,
|
||||||
AccountSettingsModalComponent,
|
AccountSettingsModalComponent,
|
||||||
SignUpComponent,
|
SignUpComponent,
|
||||||
@ -44,10 +42,11 @@ import { PasswordSettingService } from './password-setting/password-setting.serv
|
|||||||
ResetPasswordComponent,
|
ResetPasswordComponent,
|
||||||
SignUpPageComponent],
|
SignUpPageComponent],
|
||||||
exports: [
|
exports: [
|
||||||
SignInComponent,
|
|
||||||
PasswordSettingComponent,
|
PasswordSettingComponent,
|
||||||
AccountSettingsModalComponent,
|
AccountSettingsModalComponent,
|
||||||
|
ForgotPasswordComponent,
|
||||||
ResetPasswordComponent,
|
ResetPasswordComponent,
|
||||||
|
SignUpComponent,
|
||||||
SignUpPageComponent],
|
SignUpPageComponent],
|
||||||
|
|
||||||
providers: [PasswordSettingService]
|
providers: [PasswordSettingService]
|
||||||
|
@ -19,6 +19,7 @@ import { BaseModule } from './base/base.module';
|
|||||||
import { HarborRoutingModule } from './harbor-routing.module';
|
import { HarborRoutingModule } from './harbor-routing.module';
|
||||||
import { SharedModule } from './shared/shared.module';
|
import { SharedModule } from './shared/shared.module';
|
||||||
import { AccountModule } from './account/account.module';
|
import { AccountModule } from './account/account.module';
|
||||||
|
import { SignInModule } from './sign-in/sign-in.module';
|
||||||
import { ConfigurationModule } from './config/config.module';
|
import { ConfigurationModule } from './config/config.module';
|
||||||
import { DeveloperCenterModule } from './dev-center/dev-center.module';
|
import { DeveloperCenterModule } from './dev-center/dev-center.module';
|
||||||
import { registerLocaleData } from '@angular/common';
|
import { registerLocaleData } from '@angular/common';
|
||||||
@ -63,6 +64,7 @@ export function getCurrentLanguage(translateService: TranslateService) {
|
|||||||
SharedModule,
|
SharedModule,
|
||||||
BaseModule,
|
BaseModule,
|
||||||
AccountModule,
|
AccountModule,
|
||||||
|
SignInModule,
|
||||||
HarborRoutingModule,
|
HarborRoutingModule,
|
||||||
ConfigurationModule,
|
ConfigurationModule,
|
||||||
DeveloperCenterModule,
|
DeveloperCenterModule,
|
||||||
|
@ -46,7 +46,7 @@ import { SearchTriggerService } from './global-search/search-trigger.service';
|
|||||||
HarborShellComponent,
|
HarborShellComponent,
|
||||||
SearchResultComponent,
|
SearchResultComponent,
|
||||||
],
|
],
|
||||||
exports: [ HarborShellComponent ],
|
exports: [ HarborShellComponent, NavigatorComponent, SearchResultComponent ],
|
||||||
providers: [SearchTriggerService]
|
providers: [SearchTriggerService]
|
||||||
})
|
})
|
||||||
export class BaseModule {
|
export class BaseModule {
|
||||||
|
@ -28,7 +28,7 @@ import { GcPageComponent } from './gc-page/gc-page.component';
|
|||||||
import { VulnerabilityPageComponent } from './vulnerability-page/vulnerability-page.component';
|
import { VulnerabilityPageComponent } from './vulnerability-page/vulnerability-page.component';
|
||||||
|
|
||||||
import { UserComponent } from './user/user.component';
|
import { UserComponent } from './user/user.component';
|
||||||
import { SignInComponent } from './account/sign-in/sign-in.component';
|
import { SignInComponent } from './sign-in/sign-in.component';
|
||||||
import { ResetPasswordComponent } from './account/password-setting/reset-password/reset-password.component';
|
import { ResetPasswordComponent } from './account/password-setting/reset-password/reset-password.component';
|
||||||
import { GroupComponent } from './group/group.component';
|
import { GroupComponent } from './group/group.component';
|
||||||
|
|
||||||
@ -69,16 +69,17 @@ const harborRoutes: Routes = [
|
|||||||
canActivate: [OidcGuard, SignInGuard]
|
canActivate: [OidcGuard, SignInGuard]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'harbor',
|
path: 'harbor/sign-in',
|
||||||
component: HarborShellComponent,
|
|
||||||
canActivateChild: [AuthCheckGuard],
|
|
||||||
children: [
|
|
||||||
{ path: '', redirectTo: 'sign-in', pathMatch: 'full' },
|
|
||||||
{
|
|
||||||
path: 'sign-in',
|
|
||||||
component: SignInComponent,
|
component: SignInComponent,
|
||||||
canActivate: [ SignInGuard]
|
canActivate: [ SignInGuard]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'harbor',
|
||||||
|
component: HarborShellComponent,
|
||||||
|
// canActivate: [AuthCheckGuard],
|
||||||
|
canActivateChild: [AuthCheckGuard],
|
||||||
|
children: [
|
||||||
|
{ path: '', redirectTo: 'projects', pathMatch: 'full' },
|
||||||
{
|
{
|
||||||
path: 'projects',
|
path: 'projects',
|
||||||
component: ProjectComponent
|
component: ProjectComponent
|
||||||
|
@ -72,7 +72,9 @@ export class AuthCheckGuard implements CanActivate, CanActivateChild {
|
|||||||
let user = this.authService.getCurrentUser();
|
let user = this.authService.getCurrentUser();
|
||||||
if (!user) {
|
if (!user) {
|
||||||
this.authService.retrieveUser()
|
this.authService.retrieveUser()
|
||||||
.subscribe(() => observer.next(true)
|
.subscribe(() => {
|
||||||
|
return observer.next(true);
|
||||||
|
}
|
||||||
, error => {
|
, error => {
|
||||||
// If is guest, skip it
|
// If is guest, skip it
|
||||||
if (this.isGuest(route, state)) {
|
if (this.isGuest(route, state)) {
|
||||||
@ -81,7 +83,7 @@ export class AuthCheckGuard implements CanActivate, CanActivateChild {
|
|||||||
// Session retrieving failed then redirect to sign-in
|
// Session retrieving failed then redirect to sign-in
|
||||||
// no matter what status code is.
|
// no matter what status code is.
|
||||||
// Please pay attention that route 'HARBOR_ROOT' and 'EMBEDDED_SIGN_IN' support anonymous user
|
// Please pay attention that route 'HARBOR_ROOT' and 'EMBEDDED_SIGN_IN' support anonymous user
|
||||||
if (state.url !== CommonRoutes.HARBOR_ROOT && !state.url.startsWith(CommonRoutes.EMBEDDED_SIGN_IN)) {
|
if (!state.url.startsWith(CommonRoutes.EMBEDDED_SIGN_IN)) {
|
||||||
let navigatorExtra: NavigationExtras = {
|
let navigatorExtra: NavigationExtras = {
|
||||||
queryParams: { "redirect_url": state.url }
|
queryParams: { "redirect_url": state.url }
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
<clr-main-container><global-message [isAppLevel]="true"></global-message>
|
||||||
|
<navigator></navigator>
|
||||||
|
<search-result></search-result>
|
||||||
<div class="login-wrapper"
|
<div class="login-wrapper"
|
||||||
[ngStyle]="{'background-image': customLoginBgImg? 'url(static/images/' + customLoginBgImg + ')': ''}">
|
[ngStyle]="{'background-image': customLoginBgImg? 'url(static/images/' + customLoginBgImg + ')': ''}">
|
||||||
<form #signInForm="ngForm" class="login">
|
<form #signInForm="ngForm" class="login">
|
||||||
@ -37,8 +40,8 @@
|
|||||||
<div [class.visibility-hidden]="!isError" class="error active">
|
<div [class.visibility-hidden]="!isError" class="error active">
|
||||||
{{ 'SIGN_IN.INVALID_MSG' | translate }}
|
{{ 'SIGN_IN.INVALID_MSG' | translate }}
|
||||||
</div>
|
</div>
|
||||||
<button [disabled]="isOnGoing || !isValid" type="submit" class="btn btn-primary"
|
<button [disabled]="isOnGoing || !isValid" type="submit" class="btn btn-primary" (click)="signIn()"
|
||||||
(click)="signIn()" id="log_in">{{ 'BUTTON.LOG_IN' | translate }}</button>
|
id="log_in">{{ 'BUTTON.LOG_IN' | translate }}</button>
|
||||||
<a href="javascript:void(0)" class="signup" (click)="signUp()"
|
<a href="javascript:void(0)" class="signup" (click)="signUp()"
|
||||||
*ngIf="selfSignUp">{{ 'BUTTON.SIGN_UP_LINK' | translate }}</a>
|
*ngIf="selfSignUp">{{ 'BUTTON.SIGN_UP_LINK' | translate }}</a>
|
||||||
</div>
|
</div>
|
||||||
@ -51,5 +54,6 @@
|
|||||||
<top-repo class="repo-container"></top-repo>
|
<top-repo class="repo-container"></top-repo>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</clr-main-container>
|
||||||
<sign-up #signupDialog (userCreation)="handleUserCreation($event)"></sign-up>
|
<sign-up #signupDialog (userCreation)="handleUserCreation($event)"></sign-up>
|
||||||
<forgot-password #forgotPwdDialog></forgot-password>
|
<forgot-password #forgotPwdDialog></forgot-password>
|
@ -55,7 +55,6 @@
|
|||||||
|
|
||||||
.login-wrapper {
|
.login-wrapper {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
margin-top:-20px;
|
|
||||||
.login {
|
.login {
|
||||||
background:transparent;
|
background:transparent;
|
||||||
}
|
}
|
@ -16,19 +16,19 @@ import { Router, ActivatedRoute } from '@angular/router';
|
|||||||
import { Input, ViewChild, AfterViewChecked } from '@angular/core';
|
import { Input, ViewChild, AfterViewChecked } from '@angular/core';
|
||||||
import { NgForm } from '@angular/forms';
|
import { NgForm } from '@angular/forms';
|
||||||
|
|
||||||
import { SessionService } from '../../shared/session.service';
|
import { SessionService } from '../shared/session.service';
|
||||||
import { SignInCredential } from '../../shared/sign-in-credential';
|
import { SignInCredential } from '../shared/sign-in-credential';
|
||||||
|
|
||||||
import { SignUpComponent } from '../sign-up/sign-up.component';
|
import { SignUpComponent } from '../account/sign-up/sign-up.component';
|
||||||
import { CommonRoutes } from '../../shared/shared.const';
|
import { CommonRoutes } from '../shared/shared.const';
|
||||||
import { ForgotPasswordComponent } from '../password-setting/forgot-password/forgot-password.component';
|
import { ForgotPasswordComponent } from '../account/password-setting/forgot-password/forgot-password.component';
|
||||||
|
|
||||||
import { AppConfigService } from '../../app-config.service';
|
import { AppConfigService } from '../app-config.service';
|
||||||
import { AppConfig } from '../../app-config';
|
import { AppConfig } from '../app-config';
|
||||||
import { User } from '../../user/user';
|
import { User } from '../user/user';
|
||||||
|
|
||||||
import { CookieService, CookieOptions } from 'ngx-cookie';
|
import { CookieService, CookieOptions } from 'ngx-cookie';
|
||||||
import { SkinableConfig } from "../../skinable-config.service";
|
import { SkinableConfig } from "../skinable-config.service";
|
||||||
|
|
||||||
// Define status flags for signing in states
|
// Define status flags for signing in states
|
||||||
export const signInStatusNormal = 0;
|
export const signInStatusNormal = 0;
|
||||||
@ -271,4 +271,7 @@ export class SignInComponent implements AfterViewChecked, OnInit {
|
|||||||
forgotPassword(): void {
|
forgotPassword(): void {
|
||||||
this.forgotPwdDialog.open();
|
this.forgotPwdDialog.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
src/portal/src/app/sign-in/sign-in.module.ts
Normal file
22
src/portal/src/app/sign-in/sign-in.module.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { SignInComponent } from './sign-in.component';
|
||||||
|
import { AccountModule } from '../account/account.module';
|
||||||
|
import { BaseModule } from '../base/base.module';
|
||||||
|
import { SharedModule } from '../shared/shared.module';
|
||||||
|
import { RepositoryModule } from '../repository/repository.module';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
SignInComponent,
|
||||||
|
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
AccountModule,
|
||||||
|
SharedModule,
|
||||||
|
BaseModule,
|
||||||
|
RepositoryModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class SignInModule { }
|
@ -15,8 +15,8 @@ import { Injectable } from '@angular/core';
|
|||||||
import { Http, URLSearchParams } from '@angular/http';
|
import { Http, URLSearchParams } from '@angular/http';
|
||||||
// import 'rxjs/add/operator/toPromise';
|
// import 'rxjs/add/operator/toPromise';
|
||||||
|
|
||||||
import { SignInCredential } from '../../shared/sign-in-credential';
|
import { SignInCredential } from '../shared/sign-in-credential';
|
||||||
import {HTTP_FORM_OPTIONS} from "../../shared/shared.utils";
|
import {HTTP_FORM_OPTIONS} from "../shared/shared.utils";
|
||||||
import { map, catchError } from "rxjs/operators";
|
import { map, catchError } from "rxjs/operators";
|
||||||
import { Observable, throwError as observableThrowError } from "rxjs";
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
const signInUrl = '/c/login';
|
const signInUrl = '/c/login';
|
Loading…
Reference in New Issue
Block a user