aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/signup/signup.component.ts
diff options
context:
space:
mode:
authorbenal01 <bja4245@rit.edu>2025-04-02 23:00:14 -0400
committerGitHub <noreply@github.com>2025-04-02 23:00:14 -0400
commit2f67d2218b48937a370c5562eff5141b80475524 (patch)
treec744dd407f46f71b692aaaad6d4c66237c8ba9a5 /ufund-ui/src/app/components/signup/signup.component.ts
parent2b7c42ffacaaf884bc9497e975c0c3274e9f966e (diff)
parentfb6d8140830bbb5081056105eaa775f26885da8f (diff)
downloadJellySolutions-2f67d2218b48937a370c5562eff5141b80475524.tar.gz
JellySolutions-2f67d2218b48937a370c5562eff5141b80475524.tar.bz2
JellySolutions-2f67d2218b48937a370c5562eff5141b80475524.zip
Merge pull request #25 from RIT-SWEN-261-02/need-image
Need image support + need page image styling
Diffstat (limited to 'ufund-ui/src/app/components/signup/signup.component.ts')
-rw-r--r--ufund-ui/src/app/components/signup/signup.component.ts18
1 files changed, 8 insertions, 10 deletions
diff --git a/ufund-ui/src/app/components/signup/signup.component.ts b/ufund-ui/src/app/components/signup/signup.component.ts
index a20d828..9c37211 100644
--- a/ufund-ui/src/app/components/signup/signup.component.ts
+++ b/ufund-ui/src/app/components/signup/signup.component.ts
@@ -3,10 +3,10 @@ import {UsersService} from '../../services/users.service';
import {Router} from '@angular/router';
import {BehaviorSubject} from 'rxjs';
import {ToastsService, ToastType} from '../../services/toasts.service';
+import {AuthService} from '../../services/auth.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,17 +25,16 @@ 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,
protected router: Router,
- protected toastService: ToastsService
+ protected toastService: ToastsService,
+ protected authService: AuthService
) {}
signup(username: string | null, password: string | null) {
@@ -45,7 +44,10 @@ 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.authService.login(username, password)
+ this.router.navigate(["/"])
}).catch(ex => {
this.toastService.sendToast(ToastType.ERROR, "Unable to create account: " + friendlyHttpStatus[ex.status])
console.log(ex)
@@ -74,16 +76,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 +106,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)