-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance Login & Registration Pages (#57)
* Add UI enhancement to login and registration pages Add icons to the input field labels Remove primeNG password feedback and replace with password requirements list * Fix linting * Adjust styling for login and registration pages * Improve password requirements list * Remove weak password message * Conditionally render password list when user starts modifying the password field * Hide requirements and display a success message when user satisfies all requirements * Refactor code to render each requirement and improve naming for password validators * Fix linting * Fix nav bar Previously, the submenu's position was not relative to the body, this causes the submenu to be out of position * Update submenu to hide on scroll * Keep variables on top * Remove direct DOM manipulation * Add spinner when redirecting user to workspace --------- Co-authored-by: limcaaarl <[email protected]> Co-authored-by: Samuel Lim <[email protected]>
- Loading branch information
1 parent
6bf6136
commit 89cb0bb
Showing
18 changed files
with
234 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
frontend/src/app/account/_validators/lowercase-password.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms'; | ||
|
||
export const LOWERCASE_PASSWORD_REGEX = /^(?=.*[a-z])/; | ||
|
||
export const PASSWORD_LOWERCASE = 'passwordLowercase'; | ||
|
||
export function lowercasePasswordValidator(): ValidatorFn { | ||
return (control: AbstractControl): ValidationErrors | null => { | ||
const missingLowercase = !LOWERCASE_PASSWORD_REGEX.test(control.value); | ||
return missingLowercase ? { [PASSWORD_LOWERCASE]: true } : null; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms'; | ||
|
||
export const NUMERIC_PASSWORD_REGEX = /^(?=.*[0-9])/; | ||
|
||
export const PASSWORD_NUMERIC = 'passwordNumeric'; | ||
|
||
export function numericPasswordValidator(): ValidatorFn { | ||
return (control: AbstractControl): ValidationErrors | null => { | ||
const missingNumeric = !NUMERIC_PASSWORD_REGEX.test(control.value); | ||
return missingNumeric ? { [PASSWORD_NUMERIC]: true } : null; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms'; | ||
|
||
export const SHORT_PASSWORD_REGEX = /^(?=.{8,})/; | ||
|
||
export const PASSWORD_SHORT = 'passwordShort'; | ||
|
||
export function shortPasswordValidator(): ValidatorFn { | ||
return (control: AbstractControl): ValidationErrors | null => { | ||
const short = !SHORT_PASSWORD_REGEX.test(control.value); | ||
return short ? { [PASSWORD_SHORT]: true } : null; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms'; | ||
|
||
export const SPECIAL_PASSWORD_REGEX = /^(?=.*[!"#$%&'()*+,-.:;<=>?@\\/\\[\]^_`{|}~])/; | ||
|
||
export const PASSWORD_SPECIAL = 'passwordSpecial'; | ||
|
||
export function specialPasswordValidator(): ValidatorFn { | ||
return (control: AbstractControl): ValidationErrors | null => { | ||
const missingSpecial = !SPECIAL_PASSWORD_REGEX.test(control.value); | ||
return missingSpecial ? { [PASSWORD_SPECIAL]: true } : null; | ||
}; | ||
} |
12 changes: 12 additions & 0 deletions
12
frontend/src/app/account/_validators/uppercase-password.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms'; | ||
|
||
export const UPPERCASE_PASSWORD_REGEX = /^(?=.*[A-Z])/; | ||
|
||
export const PASSWORD_UPPERCASE = 'passwordUppercase'; | ||
|
||
export function uppercasePasswordValidator(): ValidatorFn { | ||
return (control: AbstractControl): ValidationErrors | null => { | ||
const missingUppercase = !UPPERCASE_PASSWORD_REGEX.test(control.value); | ||
return missingUppercase ? { [PASSWORD_UPPERCASE]: true } : null; | ||
}; | ||
} |
16 changes: 12 additions & 4 deletions
16
frontend/src/app/account/_validators/weak-password.validator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms'; | ||
|
||
export const STRONG_PASSWORD_REGEX = | ||
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.{8,})(?=.*[!"#$%&'()*+,-.:;<=>?@\\/\\[\]^_`{|}~])/; | ||
import { LOWERCASE_PASSWORD_REGEX } from './lowercase-password'; | ||
import { UPPERCASE_PASSWORD_REGEX } from './uppercase-password'; | ||
import { NUMERIC_PASSWORD_REGEX } from './numeric-password'; | ||
import { SPECIAL_PASSWORD_REGEX } from './special-password'; | ||
import { SHORT_PASSWORD_REGEX } from './short-password'; | ||
|
||
export const PASSWORD_WEAK = 'passwordWeak'; | ||
|
||
export function weakPasswordValidator(): ValidatorFn { | ||
return (control: AbstractControl): ValidationErrors | null => { | ||
const weak = !STRONG_PASSWORD_REGEX.test(control.value); | ||
const weak = !( | ||
LOWERCASE_PASSWORD_REGEX.test(control.value) && | ||
UPPERCASE_PASSWORD_REGEX.test(control.value) && | ||
NUMERIC_PASSWORD_REGEX.test(control.value) && | ||
SPECIAL_PASSWORD_REGEX.test(control.value) && | ||
SHORT_PASSWORD_REGEX.test(control.value) | ||
); | ||
return weak ? { [PASSWORD_WEAK]: true } : null; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
<div class="flex flex-column h-full w-full justify-content-center align-items-center p-2" style="margin-top: -80px"> | ||
<h2 class="mb-2">Welcome to PeerPrep</h2> | ||
<div class="layout-container"> | ||
<router-outlet></router-outlet> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.