aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/signup/signup.component.ts
diff options
context:
space:
mode:
authorTyler Ferrari <69283684+Sowgro@users.noreply.github.com>2025-04-01 02:17:25 -0400
committerGitHub <noreply@github.com>2025-04-01 02:17:25 -0400
commit233fe120d2a9b30e0150401ebdfeb946dc9c2c07 (patch)
tree98583e1b1d21d1a0cc57e8ff3489fbbf758eccff /ufund-ui/src/app/components/signup/signup.component.ts
parentc6bbb29f42eaea7d0c8aebdb7b95be0287cbf4f9 (diff)
parent0e9c0803e35a23ef2e873dc7ebf224a49a92f207 (diff)
downloadJellySolutions-233fe120d2a9b30e0150401ebdfeb946dc9c2c07.tar.gz
JellySolutions-233fe120d2a9b30e0150401ebdfeb946dc9c2c07.tar.bz2
JellySolutions-233fe120d2a9b30e0150401ebdfeb946dc9c2c07.zip
Merge pull request #22 from RIT-SWEN-261-02/css
Merge css into main
Diffstat (limited to 'ufund-ui/src/app/components/signup/signup.component.ts')
-rw-r--r--ufund-ui/src/app/components/signup/signup.component.ts14
1 files changed, 8 insertions, 6 deletions
diff --git a/ufund-ui/src/app/components/signup/signup.component.ts b/ufund-ui/src/app/components/signup/signup.component.ts
index 3b43287..a20d828 100644
--- a/ufund-ui/src/app/components/signup/signup.component.ts
+++ b/ufund-ui/src/app/components/signup/signup.component.ts
@@ -2,6 +2,7 @@ import {Component} from '@angular/core';
import {UsersService} from '../../services/users.service';
import {Router} from '@angular/router';
import {BehaviorSubject} from 'rxjs';
+import {ToastsService, ToastType} from '../../services/toasts.service';
class PasswordRequirements {
sixLong: {title: string, value: boolean} = {title: 'Is 6 characters or longer' , value: false}
@@ -22,7 +23,7 @@ class PasswordRequirements {
export class SignupComponent {
protected passwordStatusText = new BehaviorSubject("")
- protected confirmPassStatusText = new BehaviorSubject("")
+ protected passwordsMatch = new BehaviorSubject(false)
protected usernameStatusText = new BehaviorSubject("")
protected showSuccessMessage = new BehaviorSubject(false)
protected passwordStrongEnough = new BehaviorSubject(false)
@@ -34,6 +35,7 @@ export class SignupComponent {
constructor(
protected usersService: UsersService,
protected router: Router,
+ protected toastService: ToastsService
) {}
signup(username: string | null, password: string | null) {
@@ -45,13 +47,13 @@ export class SignupComponent {
this.usersService.createUser(username, password).then(() => {
this.showSuccessMessage.next(true);
}).catch(ex => {
- this.statusText.next("Unable to create account: " + friendlyHttpStatus[ex.status])
+ this.toastService.sendToast(ToastType.ERROR, "Unable to create account: " + friendlyHttpStatus[ex.status])
console.log(ex)
})
}
validate(username: string, passConfirm:string, password: string) {
- this.confirmPassStatusText.next("")
+ this.passwordsMatch.next(false)
this.usernameStatusText.next("")
this.checkPasswordStrength(password);
@@ -59,8 +61,8 @@ export class SignupComponent {
this.usernameStatusText.next("Username field can't be blank")
}
- if (!(password === passConfirm) && !!passConfirm) {
- this.confirmPassStatusText.next("Passwords don't match")
+ if (passConfirm && password === passConfirm) {
+ this.passwordsMatch.next(true)
}
this.ableToCreateAccount.next(this.passwordStrongEnough.getValue() && password === passConfirm && !!username)
}
@@ -106,7 +108,7 @@ export class SignupComponent {
} else if (strength == 0) {
this.passwordStatusText.next("")
} else {
- this.passwordStatusText.next("Password does not meet requirements")
+ this.passwordStatusText.next("5/6 checks required")
}
this.strength.next(strength)