mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-12 10:50:44 +01:00
Merge pull request #1409 from vmware/fix/module_refine
refine module paths
This commit is contained in:
commit
793416e4a7
@ -4,6 +4,7 @@ import { CoreModule } from '../core/core.module';
|
||||
|
||||
import { SignInComponent } from './sign-in/sign-in.component';
|
||||
import { PasswordSettingComponent } from './password/password-setting.component';
|
||||
import { AccountSettingsModalComponent } from './account-settings/account-settings-modal.component';
|
||||
|
||||
import { PasswordSettingService } from './password/password-setting.service';
|
||||
|
||||
@ -12,8 +13,8 @@ import { PasswordSettingService } from './password/password-setting.service';
|
||||
CoreModule,
|
||||
RouterModule
|
||||
],
|
||||
declarations: [SignInComponent, PasswordSettingComponent],
|
||||
exports: [SignInComponent, PasswordSettingComponent],
|
||||
declarations: [SignInComponent, PasswordSettingComponent, AccountSettingsModalComponent],
|
||||
exports: [SignInComponent, PasswordSettingComponent, AccountSettingsModalComponent],
|
||||
|
||||
providers: [PasswordSettingService]
|
||||
})
|
||||
|
@ -26,7 +26,7 @@
|
||||
[(ngModel)]="newPwd"
|
||||
#newPassInput="ngModel" size="25">
|
||||
<span class="tooltip-content">
|
||||
Password should be at least 7 characters with 1 uppercase,lowercase letetr and 1 number
|
||||
Password should be at least 7 characters with 1 uppercase, 1 lowercase letter and 1 number
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
@ -40,7 +40,7 @@
|
||||
[(ngModel)]="reNewPwd"
|
||||
#reNewPassInput="ngModel" size="25">
|
||||
<span class="tooltip-content">
|
||||
Password should be at least 7 characters with 1 uppercase,lowercase letetr and 1 number and consisted with new password
|
||||
Password should be at least 7 characters with 1 uppercase, 1 lowercase letter and 1 number and same with new password
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
@ -3,9 +3,8 @@ import { Router } from '@angular/router';
|
||||
import { Input, ViewChild, AfterViewChecked } from '@angular/core';
|
||||
import { NgForm } from '@angular/forms';
|
||||
|
||||
import { SignInService } from './sign-in.service';
|
||||
import { SignInCredential } from './sign-in-credential'
|
||||
import { SessionService } from '../../shared/session.service';
|
||||
import { SignInCredential } from '../../shared/sign-in-credential';
|
||||
|
||||
//Define status flags for signing in states
|
||||
export const signInStatusNormal = 0;
|
||||
@ -15,9 +14,7 @@ export const signInStatusError = -1;
|
||||
@Component({
|
||||
selector: 'sign-in',
|
||||
templateUrl: "sign-in.component.html",
|
||||
styleUrls: ['sign-in.component.css'],
|
||||
|
||||
providers: [SignInService]
|
||||
styleUrls: ['sign-in.component.css']
|
||||
})
|
||||
|
||||
export class SignInComponent implements AfterViewChecked {
|
||||
@ -35,7 +32,6 @@ export class SignInComponent implements AfterViewChecked {
|
||||
};
|
||||
|
||||
constructor(
|
||||
private signInService: SignInService,
|
||||
private router: Router,
|
||||
private session: SessionService
|
||||
) { }
|
||||
@ -105,7 +101,7 @@ export class SignInComponent implements AfterViewChecked {
|
||||
this.signInStatus = signInStatusOnGoing;
|
||||
|
||||
//Call the service to send out the http request
|
||||
this.signInService.signIn(this.signInCredential)
|
||||
this.session.signIn(this.signInCredential)
|
||||
.then(() => {
|
||||
//Set status
|
||||
this.signInStatus = signInStatusNormal;
|
||||
|
@ -9,7 +9,6 @@ import { NavigatorComponent } from './navigator/navigator.component';
|
||||
import { GlobalSearchComponent } from './global-search/global-search.component';
|
||||
import { FooterComponent } from './footer/footer.component';
|
||||
import { HarborShellComponent } from './harbor-shell/harbor-shell.component';
|
||||
import { AccountSettingsModalComponent } from './account-settings/account-settings-modal.component';
|
||||
import { SearchResultComponent } from './global-search/search-result.component';
|
||||
|
||||
import { BaseRoutingModule } from './base-routing.module';
|
||||
@ -27,7 +26,6 @@ import { BaseRoutingModule } from './base-routing.module';
|
||||
GlobalSearchComponent,
|
||||
FooterComponent,
|
||||
HarborShellComponent,
|
||||
AccountSettingsModalComponent,
|
||||
SearchResultComponent
|
||||
],
|
||||
exports: [ HarborShellComponent ]
|
||||
|
@ -5,7 +5,7 @@ import { ModalEvent } from '../modal-event';
|
||||
import { SearchEvent } from '../search-event';
|
||||
import { modalAccountSettings, modalPasswordSetting } from '../modal-events.const';
|
||||
|
||||
import { AccountSettingsModalComponent } from '../account-settings/account-settings-modal.component';
|
||||
import { AccountSettingsModalComponent } from '../../account/account-settings/account-settings-modal.component';
|
||||
import { SearchResultComponent } from '../global-search/search-result.component';
|
||||
import { PasswordSettingComponent } from '../../account/password/password-setting.component';
|
||||
import { NavigatorComponent } from '../navigator/navigator.component';
|
||||
|
@ -1,9 +1,11 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Headers, Http } from '@angular/http';
|
||||
import { Headers, Http, URLSearchParams } from '@angular/http';
|
||||
import 'rxjs/add/operator/toPromise';
|
||||
|
||||
import { SessionUser } from './session-user';
|
||||
import { SignInCredential } from './sign-in-credential';
|
||||
|
||||
const signInUrl = '/login';
|
||||
const currentUserEndpint = "/api/users/current";
|
||||
const signOffEndpoint = "/log_out";
|
||||
const accountEndpoint = "/api/users/:id";
|
||||
@ -21,8 +23,31 @@ export class SessionService {
|
||||
"Content-Type": 'application/json'
|
||||
});
|
||||
|
||||
private formHeaders = new Headers({
|
||||
"Content-Type": 'application/x-www-form-urlencoded'
|
||||
});
|
||||
|
||||
constructor(private http: Http) {}
|
||||
|
||||
//Handle the related exceptions
|
||||
private handleError(error: any): Promise<any>{
|
||||
return Promise.reject(error.message || error);
|
||||
}
|
||||
|
||||
//Submit signin form to backend (NOT restful service)
|
||||
signIn(signInCredential: SignInCredential): Promise<any>{
|
||||
//Build the form package
|
||||
const body = new URLSearchParams();
|
||||
body.set('principal', signInCredential.principal);
|
||||
body.set('password', signInCredential.password);
|
||||
|
||||
//Trigger Http
|
||||
return this.http.post(signInUrl, body.toString(), { headers: this.formHeaders })
|
||||
.toPromise()
|
||||
.then(()=>null)
|
||||
.catch(error => this.handleError(error));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the related information of current signed in user from backend
|
||||
*
|
||||
@ -36,10 +61,7 @@ export class SessionService {
|
||||
this.currentUser = response.json() as SessionUser;
|
||||
return this.currentUser;
|
||||
})
|
||||
.catch(error => {
|
||||
console.log("An error occurred when getting current user ", error);//TODO
|
||||
return Promise.reject(error);
|
||||
})
|
||||
.catch(error => this.handleError(error))
|
||||
}
|
||||
|
||||
/**
|
||||
@ -58,10 +80,7 @@ export class SessionService {
|
||||
//Destroy current session cache
|
||||
this.currentUser = null;
|
||||
}) //Nothing returned
|
||||
.catch(error => {
|
||||
console.log("An error occurred when signing off ", error);//TODO
|
||||
return Promise.reject(error);
|
||||
})
|
||||
.catch(error => this.handleError(error))
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,8 +103,6 @@ export class SessionService {
|
||||
//Retrieve current session user
|
||||
return this.retrieveUser();
|
||||
})
|
||||
.catch(error => {
|
||||
return Promise.reject(error);
|
||||
})
|
||||
.catch(error => this.handleError(error))
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user