mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
fix issue 1860 and other minor remending
This commit is contained in:
parent
966b476d36
commit
9b9be0253c
@ -13,7 +13,8 @@
|
||||
<label for="account_settings_email" aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-top-left" [class.invalid]='!getValidationState("account_settings_email")'>
|
||||
<input name="account_settings_email" type="text" #eamilInput="ngModel" [(ngModel)]="account.email"
|
||||
required
|
||||
pattern='^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$' id="account_settings_email" size="30"
|
||||
email
|
||||
id="account_settings_email" size="30"
|
||||
(input)='handleValidation("account_settings_email", false)'
|
||||
(focusout)='handleValidation("account_settings_email", true)'>
|
||||
<span class="tooltip-content">
|
||||
|
@ -28,7 +28,7 @@
|
||||
required
|
||||
pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{8,20}$"
|
||||
name="reNewPassword"
|
||||
[(ngModel)]="ngModel"
|
||||
[(ngModel)]="confirmPwd"
|
||||
#reNewPassInput
|
||||
size="25"
|
||||
(input)='handleValidation("reNewPassword", true)'
|
||||
|
@ -21,6 +21,7 @@ export class ResetPasswordComponent implements OnInit {
|
||||
};
|
||||
private resetUuid: string = "";
|
||||
private resetOk: boolean = false;
|
||||
confirmPwd: string = "";
|
||||
|
||||
@ViewChild("resetPwdForm") resetPwdForm: NgForm;
|
||||
@ViewChild(InlineAlertComponent)
|
||||
|
@ -162,7 +162,8 @@ export class SignInComponent implements AfterViewChecked, OnInit {
|
||||
private handleUserCreation(user: User): void {
|
||||
if (user) {
|
||||
this.currentForm.setValue({
|
||||
"login_username": user.username
|
||||
"login_username": user.username,
|
||||
"login_password": ""
|
||||
});
|
||||
|
||||
}
|
||||
|
33
src/ui_ng/src/app/shared/email.directive.ts
Normal file
33
src/ui_ng/src/app/shared/email.directive.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import { Directive } from '@angular/core';
|
||||
import { ValidatorFn, AbstractControl, Validator, NG_VALIDATORS, Validators } from '@angular/forms';
|
||||
|
||||
const emailPattern = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||
|
||||
export function emailValidator(): ValidatorFn {
|
||||
return (control: AbstractControl): { [key: string]: any } => {
|
||||
const value: string = control.value
|
||||
if (!value) {
|
||||
return { 'email': false };
|
||||
}
|
||||
|
||||
const regExp = new RegExp(emailPattern);
|
||||
if(!regExp.test(value)){
|
||||
return { 'email': false };
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Directive({
|
||||
selector: '[email]',
|
||||
providers: [{ provide: NG_VALIDATORS, useExisting: EmailValidatorDirective, multi: true }]
|
||||
})
|
||||
|
||||
export class EmailValidatorDirective implements Validator {
|
||||
valFn = emailValidator();
|
||||
|
||||
validate(control: AbstractControl): { [key: string]: any } {
|
||||
return this.valFn(control);
|
||||
}
|
||||
}
|
@ -17,7 +17,8 @@
|
||||
<label for="email" aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left" [class.invalid]='getValidationState("email")'>
|
||||
<input name="email" type="text" #eamilInput="ngModel" [(ngModel)]="newUser.email"
|
||||
required
|
||||
pattern='^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$' id="email" size="36"
|
||||
email
|
||||
id="email" size="36"
|
||||
(input)='handleValidation("email", false)'
|
||||
(focusout)='handleValidation("email", true)'>
|
||||
<span class="tooltip-content">
|
||||
|
@ -38,6 +38,7 @@ import { ListProjectROComponent } from './list-project-ro/list-project-ro.compon
|
||||
import { ListRepositoryROComponent } from './list-repository-ro/list-repository-ro.component';
|
||||
|
||||
import { MessageHandlerService } from './message-handler/message-handler.service';
|
||||
import { EmailValidatorDirective } from './email.directive';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@ -60,7 +61,8 @@ import { MessageHandlerService } from './message-handler/message-handler.service
|
||||
StatisticsComponent,
|
||||
StatisticsPanelComponent,
|
||||
ListProjectROComponent,
|
||||
ListRepositoryROComponent
|
||||
ListRepositoryROComponent,
|
||||
EmailValidatorDirective
|
||||
],
|
||||
exports: [
|
||||
CoreModule,
|
||||
@ -79,7 +81,8 @@ import { MessageHandlerService } from './message-handler/message-handler.service
|
||||
StatisticsComponent,
|
||||
StatisticsPanelComponent,
|
||||
ListProjectROComponent,
|
||||
ListRepositoryROComponent
|
||||
ListRepositoryROComponent,
|
||||
EmailValidatorDirective
|
||||
],
|
||||
providers: [
|
||||
SessionService,
|
||||
|
@ -130,9 +130,7 @@ export class UserComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
//Value copy
|
||||
let updatedUser: User = {
|
||||
user_id: user.user_id
|
||||
};
|
||||
let updatedUser: User = new User(user.user_id);;
|
||||
|
||||
if (user.has_admin_role === 0) {
|
||||
updatedUser.has_admin_role = 1;//Set as admin
|
||||
|
@ -5,6 +5,10 @@
|
||||
* @class User
|
||||
*/
|
||||
export class User {
|
||||
constructor(userId: number){
|
||||
this.user_id = userId;
|
||||
}
|
||||
|
||||
user_id: number;
|
||||
username?: string;
|
||||
realname?: string;
|
||||
|
@ -112,7 +112,7 @@
|
||||
"IS_ADMIN": "Yes",
|
||||
"IS_NOT_ADMIN": "No",
|
||||
"ADD_USER_TITLE": "New User",
|
||||
"SAVE_SUCCESS": "New user added successfully",
|
||||
"SAVE_SUCCESS": "New user created successfully",
|
||||
"DELETION_TITLE": "Confirm user deletion",
|
||||
"DELETION_SUMMARY": "Do you want to delete user {{param}}?",
|
||||
"DELETE_SUCCESS": "User deleted successfully",
|
||||
@ -325,7 +325,7 @@
|
||||
"COPY": "Copy"
|
||||
},
|
||||
"ALERT": {
|
||||
"FORM_CHANGE_CONFIRMATION": "Some changes are not saved yet, do you really want to cancel?"
|
||||
"FORM_CHANGE_CONFIRMATION": "Some changes are not saved yet, do you want to cancel?"
|
||||
},
|
||||
"RESET_PWD": {
|
||||
"TITLE": "Reset Password",
|
||||
@ -392,7 +392,7 @@
|
||||
"TEST_MAIL_FAILED": "Failed to verify mail server with error: {{param}}",
|
||||
"TEST_LDAP_FAILED": "Failed to verify LDAP server with error: {{param}}",
|
||||
"LEAVING_CONFIRMATION_TITLE": "Confirm to leave",
|
||||
"LEAVING_CONFIRMATION_SUMMARY": "Changes have not been saved yet,do you really want to leave currnet page?"
|
||||
"LEAVING_CONFIRMATION_SUMMARY": "Changes have not been saved yet, do you want to leave currnet page?"
|
||||
},
|
||||
"PAGE_NOT_FOUND": {
|
||||
"MAIN_TITLE": "Page not found",
|
||||
|
@ -112,7 +112,7 @@
|
||||
"IS_ADMIN": "是",
|
||||
"IS_NOT_ADMIN": "否",
|
||||
"ADD_USER_TITLE": "创建用户",
|
||||
"SAVE_SUCCESS": "添加用户成功",
|
||||
"SAVE_SUCCESS": "创建用户成功",
|
||||
"DELETION_TITLE": "删除用户确认",
|
||||
"DELETION_SUMMARY": "你确认删除用户 {{param}}?",
|
||||
"DELETE_SUCCESS": "删除用户成功",
|
||||
|
Loading…
Reference in New Issue
Block a user