- Notifications
You must be signed in to change notification settings - Fork 15
Feat/51 - Design Forgot Password Page #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 21 commits
Commits
Show all changes
22 commits Select commit Hold shift + click to select a range
3c559fe
moved components to the core/components folder
rnastyuk 8273b6a
added basic login component
rnastyuk 01776c3
added auth service and auth store
rnastyuk d9ee0b6
removed login component, added sign-in and sign-up components
rnastyuk d0f43ba
removed redundant modifiers in auth service
rnastyuk 23da6fa
chore(merge): main into 49
rnastyuk 77d8953
chore(primeng-setup): basic design system configuration
rnastyuk 866b053
Merge branch 'refs/heads/main' into chore/101-setup-primeng-design-sy…
rnastyuk fb38072
chore(primeng-setup): removed sign-in component
rnastyuk 5731428
chore(primeng-setup): changed all private modifiers to '#'
rnastyuk 1aa3a94
Merge branch 'refs/heads/main' into chore/101-setup-primeng-design-sy…
rnastyuk e15b309
feat(sign-up-design): create initial form layout
rnastyuk 773cc6d
Merge branch 'main' into feat/49-design-sign-up-form
rnastyuk 2e796bf
Merge branch 'refs/heads/main' into feat/49-design-sign-up-form
rnastyuk 1ecfbbf
feat(sign-up-design): changed icons, finished form layout
rnastyuk 0cf97d1
feat(sign-up-design): changed regexp, added autocomplete input attrib…
rnastyuk e89ae1e
feat(sign-up-design): removed console log
rnastyuk 31c1d05
Merge remote-tracking branch 'origin/feat/49-design-sign-up-form' int…
rnastyuk ca54337
feat(sign-up-design): fixed some styles, added dynamic header button …
rnastyuk 0d1b880
Merge branch 'refs/heads/main' into feat/49-design-sign-up-form
rnastyuk f72db40
feat(forgot-password-design): added forgot-password page layout
rnastyuk a7efe46
feat(forgot-password-design): resolved review comments
rnastyuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,3 +1 @@ | ||
<a [routerLink]="authButtonLink()" class="p-button">{{ authButtonText() }}</a> | ||
| ||
<p-button label="Donate" severity="contrast" /> |
This file contains hidden or 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 hidden or 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
35 changes: 35 additions & 0 deletions 35 src/app/features/auth/forgot-password/forgot-password.component.html
This file contains hidden or 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,35 @@ | ||
<section class="forgot-password-container"> | ||
<h2>Forgot Your Password?</h2> | ||
<p>Enter your email address and we'll send a link to reset your password</p> | ||
| ||
<form [formGroup]="forgotPasswordForm" (ngSubmit)="onSubmit()"> | ||
<label for="email">Email</label> | ||
<input | ||
class="email-input" | ||
id="email" | ||
type="email" | ||
pInputText | ||
formControlName="email" | ||
placeholder="email@example.com" | ||
autocomplete="off" | ||
/> | ||
| ||
<p-button | ||
class="btn-full-width" | ||
type="submit" | ||
label="Reset Password" | ||
[disabled]="!forgotPasswordForm.valid" | ||
></p-button> | ||
</form> | ||
| ||
<div class="message-container"> | ||
@if (message()) { | ||
<p-message | ||
[severity]="message()?.severity" | ||
closable="true" | ||
[text]="message()?.content" | ||
(onClose)="onCloseMessage()" | ||
/> | ||
} | ||
</div> | ||
</section> |
37 changes: 37 additions & 0 deletions 37 src/app/features/auth/forgot-password/forgot-password.component.scss
This file contains hidden or 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,37 @@ | ||
@use "assets/styles/mixins" as mix; | ||
@use "assets/styles/variables" as var; | ||
| ||
:host { | ||
@include mix.flex-center; | ||
flex: 1; | ||
background: url("/assets/images/auth-background.png") center no-repeat; | ||
background-size: cover; | ||
| ||
.forgot-password-container { | ||
position: relative; | ||
@include mix.flex-column; | ||
color: var.$dark-blue-1; | ||
max-width: 32rem; | ||
flex: 1; | ||
gap: 1.2rem; | ||
padding: 2rem; | ||
background: white; | ||
border-radius: 0.6rem; | ||
box-shadow: 0 2px 4px var.$grey-outline; | ||
| ||
h2 { | ||
text-align: center; | ||
} | ||
| ||
.email-input { | ||
margin-bottom: 2.5rem; | ||
} | ||
| ||
.message-container { | ||
width: 100%; | ||
position: absolute; | ||
bottom: -4.5rem; | ||
left: 0; | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions 22 src/app/features/auth/forgot-password/forgot-password.component.spec.ts
This file contains hidden or 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,22 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
| ||
import { ForgotPasswordComponent } from './forgot-password.component'; | ||
| ||
describe('ForgotPasswordComponent', () => { | ||
let component: ForgotPasswordComponent; | ||
let fixture: ComponentFixture<ForgotPasswordComponent>; | ||
| ||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ForgotPasswordComponent], | ||
}).compileComponents(); | ||
| ||
fixture = TestBed.createComponent(ForgotPasswordComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
| ||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
49 changes: 49 additions & 0 deletions 49 src/app/features/auth/forgot-password/forgot-password.component.ts
This file contains hidden or 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,49 @@ | ||
import { Component, inject, signal } from '@angular/core'; | ||
import { InputText } from 'primeng/inputtext'; | ||
import { | ||
ReactiveFormsModule, | ||
FormBuilder, | ||
FormGroup, | ||
Validators, | ||
} from '@angular/forms'; | ||
import { Button } from 'primeng/button'; | ||
import { MessageInfo } from './message-info.model'; | ||
import { Message } from 'primeng/message'; | ||
| ||
@Component({ | ||
selector: 'osf-forgot-password', | ||
standalone: true, | ||
imports: [InputText, ReactiveFormsModule, Button, Message], | ||
templateUrl: './forgot-password.component.html', | ||
styleUrl: './forgot-password.component.scss', | ||
}) | ||
export class ForgotPasswordComponent { | ||
forgotPasswordForm: FormGroup; | ||
message = signal<null | MessageInfo>(null); | ||
private fb = inject(FormBuilder); | ||
| ||
constructor() { | ||
this.forgotPasswordForm = this.fb.group({ | ||
email: ['', [Validators.required, Validators.email]], | ||
}); | ||
} | ||
| ||
onSubmit(): void { | ||
// TODO: Implement password reset logic | ||
if (this.forgotPasswordForm.valid) { | ||
this.message.set({ | ||
severity: 'success', | ||
content: 'Thanks. Check your email to reset your password.', | ||
}); | ||
| ||
// this.message.set({ | ||
// severity: 'error', | ||
// content: 'Email not found.', | ||
// }); | ||
} | ||
} | ||
| ||
onCloseMessage(): void { | ||
this.message.set(null); | ||
} | ||
} |
This file contains hidden or 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,4 @@ | ||
export interface MessageInfo { | ||
severity: 'error' | 'warn' | 'success'; | ||
content: string; | ||
} |
60 changes: 60 additions & 0 deletions 60 src/app/features/auth/reset-password/reset-password.component.html
This file contains hidden or 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,60 @@ | ||
@if (!isFormSubmitted()) { | ||
<section class="reset-password-container"> | ||
<h2>Reset Password</h2> | ||
| ||
<form [formGroup]="resetPasswordForm" (ngSubmit)="onSubmit()"> | ||
<div class="field"> | ||
<label for="password">New Password</label> | ||
<p-password | ||
id="password" | ||
formControlName="password" | ||
[toggleMask]="true" | ||
[feedback]="false" | ||
autocomplete="new-password" | ||
></p-password> | ||
| ||
<osf-password-input-hint | ||
[isError]=" | ||
resetPasswordForm.get('password')?.errors && | ||
resetPasswordForm.get('password')?.touched | ||
" | ||
/> | ||
</div> | ||
| ||
<div class="field"> | ||
<label for="confirmPassword">Confirm New Password</label> | ||
<p-password | ||
id="confirmPassword" | ||
formControlName="confirmPassword" | ||
[toggleMask]="true" | ||
[feedback]="false" | ||
autocomplete="new-password" | ||
></p-password> | ||
@if ( | ||
resetPasswordForm.get("confirmPassword")?.errors?.[ | ||
"passwordMismatch" | ||
] && resetPasswordForm.get("confirmPassword")?.touched | ||
) { | ||
<small class="text-danger">Passwords must match</small> | ||
} | ||
</div> | ||
| ||
<p-button | ||
class="btn-full-width" | ||
type="submit" | ||
label="Reset Password" | ||
[disabled]="!resetPasswordForm.valid" | ||
rnastyuk marked this conversation as resolved. Outdated Show resolved Hide resolved | ||
></p-button> | ||
</form> | ||
</section> | ||
} @else { | ||
<section class="message-container"> | ||
<h2>Thank You!</h2> | ||
<p class="message-text">You have successfully reset your password</p> | ||
<p-button | ||
class="btn-full-width" | ||
label="Back to Sign In" | ||
[routerLink]="['/sign-up']" | ||
/> | ||
</section> | ||
} |
50 changes: 50 additions & 0 deletions 50 src/app/features/auth/reset-password/reset-password.component.scss
This file contains hidden or 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,50 @@ | ||
@use "assets/styles/mixins" as mix; | ||
@use "assets/styles/variables" as var; | ||
| ||
:host { | ||
@include mix.flex-center; | ||
flex: 1; | ||
background: url("/assets/images/auth-background.png") center no-repeat; | ||
background-size: cover; | ||
| ||
.reset-password-container, | ||
.message-container { | ||
@include mix.flex-column; | ||
color: var.$dark-blue-1; | ||
max-width: 32rem; | ||
flex: 1; | ||
gap: 1.2rem; | ||
padding: 2rem; | ||
background: white; | ||
border-radius: 0.6rem; | ||
box-shadow: 0 2px 4px var.$grey-outline; | ||
| ||
h2, | ||
.message-text { | ||
text-align: center; | ||
} | ||
| ||
.message-text { | ||
margin-bottom: 1.5rem; | ||
} | ||
| ||
form { | ||
@include mix.flex-column; | ||
flex: 1; | ||
| ||
.field { | ||
margin-bottom: 1rem; | ||
| ||
.text-danger { | ||
color: var.$red-1; | ||
font-weight: 600; | ||
} | ||
} | ||
| ||
small { | ||
color: var.$pr-blue-1; | ||
font-weight: 600; | ||
} | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions 22 src/app/features/auth/reset-password/reset-password.component.spec.ts
This file contains hidden or 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,22 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
| ||
import { ResetPasswordComponent } from './reset-password.component'; | ||
| ||
describe('ResetPasswordComponent', () => { | ||
let component: ResetPasswordComponent; | ||
let fixture: ComponentFixture<ResetPasswordComponent>; | ||
| ||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ResetPasswordComponent], | ||
}).compileComponents(); | ||
| ||
fixture = TestBed.createComponent(ResetPasswordComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
| ||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
61 changes: 61 additions & 0 deletions 61 src/app/features/auth/reset-password/reset-password.component.ts
This file contains hidden or 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,61 @@ | ||
import { Component, inject, OnInit, signal } from '@angular/core'; | ||
import { Button } from 'primeng/button'; | ||
import { | ||
FormBuilder, | ||
FormGroup, | ||
ReactiveFormsModule, | ||
Validators, | ||
} from '@angular/forms'; | ||
import { Password } from 'primeng/password'; | ||
import { RouterLink } from '@angular/router'; | ||
import { | ||
PASSWORD_REGEX, | ||
passwordMatchValidator, | ||
} from '../sign-up/sign-up.helper'; | ||
import { PasswordInputHintComponent } from '@shared/components/password-input-hint/password-input-hint.component'; | ||
| ||
@Component({ | ||
selector: 'osf-reset-password', | ||
standalone: true, | ||
imports: [ | ||
Button, | ||
Password, | ||
ReactiveFormsModule, | ||
RouterLink, | ||
PasswordInputHintComponent, | ||
], | ||
templateUrl: './reset-password.component.html', | ||
styleUrl: './reset-password.component.scss', | ||
}) | ||
export class ResetPasswordComponent implements OnInit { | ||
private fb = inject(FormBuilder); | ||
rnastyuk marked this conversation as resolved. Outdated Show resolved Hide resolved | ||
passwordRegex: RegExp = PASSWORD_REGEX; | ||
rnastyuk marked this conversation as resolved. Outdated Show resolved Hide resolved | ||
resetPasswordForm: FormGroup = new FormGroup({}); | ||
isFormSubmitted = signal(false); | ||
| ||
ngOnInit(): void { | ||
rnastyuk marked this conversation as resolved. Outdated Show resolved Hide resolved | ||
this.initializeForm(); | ||
} | ||
| ||
private initializeForm(): void { | ||
this.resetPasswordForm = this.fb.group( | ||
{ | ||
password: [ | ||
'', | ||
[Validators.required, Validators.pattern(this.passwordRegex)], | ||
], | ||
confirmPassword: ['', Validators.required], | ||
}, | ||
{ | ||
validators: passwordMatchValidator(), | ||
}, | ||
); | ||
} | ||
| ||
onSubmit(): void { | ||
if (this.resetPasswordForm.valid) { | ||
// TODO: Implement password reset logic | ||
this.isFormSubmitted.set(true); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.