diff options
Diffstat (limited to 'ufund-ui/src/app/components/signup')
-rw-r--r-- | ufund-ui/src/app/components/signup/signup.component.html | 4 | ||||
-rw-r--r-- | ufund-ui/src/app/components/signup/signup.component.ts | 13 |
2 files changed, 5 insertions, 12 deletions
diff --git a/ufund-ui/src/app/components/signup/signup.component.html b/ufund-ui/src/app/components/signup/signup.component.html index bc3aaf0..84f15e4 100644 --- a/ufund-ui/src/app/components/signup/signup.component.html +++ b/ufund-ui/src/app/components/signup/signup.component.html @@ -8,7 +8,7 @@ <div> <div> <input placeholder="Password" type="password" (input)="validate(username.value, confirmPass.value, password.value)" #password> - <progress [ngClass]="'color' + strength.getValue()" id="bar" [value]="strength | async" max="6"> </progress> + <progress [ngClass]="'color' + strength.getValue()" id="bar" [value]="strength | async" max="5"> </progress> <span *ngIf="passwordStatusText">{{passwordStatusText | async}}</span> </div> @@ -24,8 +24,6 @@ <div> <button [disabled]="!(ableToCreateAccount | async)" (click)="signup(username.value, password.value)">Create Account</button> - <span *ngIf="showSuccessMessage | async">Account created <a routerLink="/login">Proceed to login</a></span> - <span *ngIf="statusText | async">{{statusText | async}}</span> </div> <span>Already have an account? <a routerLink="/login">Log in</a></span> </div> diff --git a/ufund-ui/src/app/components/signup/signup.component.ts b/ufund-ui/src/app/components/signup/signup.component.ts index a20d828..b040d1a 100644 --- a/ufund-ui/src/app/components/signup/signup.component.ts +++ b/ufund-ui/src/app/components/signup/signup.component.ts @@ -6,7 +6,6 @@ import {ToastsService, ToastType} from '../../services/toasts.service'; class PasswordRequirements { sixLong: {title: string, value: boolean} = {title: 'Is 6 characters or longer' , value: false} - twelveLong: {title: string, value: boolean} = {title: 'Is 12 characters or longer', value: false} lowercase: {title: string, value: boolean} = {title: 'Includes lowercase letter' , value: false} uppercase: {title: string, value: boolean} = {title: 'Includes uppercase letter' , value: false} number: {title: string, value: boolean} = {title: 'Includes number' , value: false} @@ -25,12 +24,10 @@ export class SignupComponent { protected passwordStatusText = new BehaviorSubject("") protected passwordsMatch = new BehaviorSubject(false) protected usernameStatusText = new BehaviorSubject("") - protected showSuccessMessage = new BehaviorSubject(false) protected passwordStrongEnough = new BehaviorSubject(false) protected ableToCreateAccount = new BehaviorSubject(false) protected passwordRequirements: PasswordRequirements = new PasswordRequirements() protected strength = new BehaviorSubject(0) - protected statusText = new BehaviorSubject(""); constructor( protected usersService: UsersService, @@ -45,7 +42,9 @@ export class SignupComponent { } this.usersService.createUser(username, password).then(() => { - this.showSuccessMessage.next(true); + // let action = {label: 'Proceed to login', onAction: () => this.router.navigate(["/login"])} + this.toastService.sendToast(ToastType.INFO, "Account successfully created") + this.router.navigate(["/login"]) }).catch(ex => { this.toastService.sendToast(ToastType.ERROR, "Unable to create account: " + friendlyHttpStatus[ex.status]) console.log(ex) @@ -74,16 +73,12 @@ export class SignupComponent { if (password.match(/[^!-~]/g)) { this.passwordStatusText.next("Invalid characters") - return } if (password.length > 6) { this.passwordRequirements.sixLong.value = true } - if (password.length > 12) { - this.passwordRequirements.twelveLong.value = true - } if (password.match(/[a-z]/g)) { this.passwordRequirements.lowercase.value = true } @@ -108,7 +103,7 @@ export class SignupComponent { } else if (strength == 0) { this.passwordStatusText.next("") } else { - this.passwordStatusText.next("5/6 checks required") + this.passwordStatusText.next("Password must meet requirements") } this.strength.next(strength) |