Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3c559fe
moved components to the core/components folder
rnastyuk Mar 3, 2025
8273b6a
added basic login component
rnastyuk Mar 3, 2025
01776c3
added auth service and auth store
rnastyuk Mar 3, 2025
d9ee0b6
removed login component, added sign-in and sign-up components
rnastyuk Mar 3, 2025
d0f43ba
removed redundant modifiers in auth service
rnastyuk Mar 4, 2025
23da6fa
chore(merge): main into 49
rnastyuk Mar 4, 2025
77d8953
chore(primeng-setup): basic design system configuration
rnastyuk Mar 7, 2025
866b053
Merge branch 'refs/heads/main' into chore/101-setup-primeng-design-sy…
rnastyuk Mar 7, 2025
fb38072
chore(primeng-setup): removed sign-in component
rnastyuk Mar 7, 2025
5731428
chore(primeng-setup): changed all private modifiers to '#'
rnastyuk Mar 7, 2025
1aa3a94
Merge branch 'refs/heads/main' into chore/101-setup-primeng-design-sy…
rnastyuk Mar 10, 2025
e15b309
feat(sign-up-design): create initial form layout
rnastyuk Mar 10, 2025
773cc6d
Merge branch 'main' into feat/49-design-sign-up-form
rnastyuk Mar 10, 2025
2e796bf
Merge branch 'refs/heads/main' into feat/49-design-sign-up-form
rnastyuk Mar 10, 2025
1ecfbbf
feat(sign-up-design): changed icons, finished form layout
rnastyuk Mar 10, 2025
0cf97d1
feat(sign-up-design): changed regexp, added autocomplete input attrib…
rnastyuk Mar 10, 2025
e89ae1e
feat(sign-up-design): removed console log
rnastyuk Mar 11, 2025
31c1d05
Merge remote-tracking branch 'origin/feat/49-design-sign-up-form' int…
rnastyuk Mar 11, 2025
ca54337
feat(sign-up-design): fixed some styles, added dynamic header button …
rnastyuk Mar 11, 2025
0d1b880
Merge branch 'refs/heads/main' into feat/49-design-sign-up-form
rnastyuk Mar 13, 2025
f72db40
feat(forgot-password-design): added forgot-password page layout
rnastyuk Mar 13, 2025
a7efe46
feat(forgot-password-design): resolved review comments
rnastyuk Mar 13, 2025
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
Prev Previous commit
feat(forgot-password-design): resolved review comments
  • Loading branch information
rnastyuk committed Mar 13, 2025
commit a7efe46e05bd23e211982ff0701bf1047208838c
20 changes: 20 additions & 0 deletions src/app/core/helpers/types.helper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export type StringOrNull = string | null;
export type StringOrNullOrUndefined = string | null | undefined;

export type BooleanOrNull = boolean | null;
export type BooleanOrNullOrUndefined = boolean | null | undefined;

export type NumberOrNull = number | null;
export type NumberOrNullOrUndefined = number | null | undefined;

export type DateOrNull = Date | null;
export type DateOrNullOrUndefined = Date | null | undefined;

export type ArrayOrNull<T> = T[] | null;
export type ArrayOrNullOrUndefined<T> = T[] | null | undefined;

export type ObjectOrNull<T> = T | null;
export type ObjectOrNullOrUndefined<T> = T | null | undefined;

export type Primitive = string | number | boolean | null | undefined;
export type NonNullablePrimitive = string | number | boolean;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { FormControl, FormGroup } from '@angular/forms';

export type ForgotPasswordFormGroupType = FormGroup<{ email: FormControl }>;
22 changes: 7 additions & 15 deletions src/app/features/auth/forgot-password/forgot-password.component.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { Component, inject, signal } from '@angular/core';
import { InputText } from 'primeng/inputtext';
import {
ReactiveFormsModule,
FormBuilder,
FormGroup,
Validators,
} from '@angular/forms';
import { ReactiveFormsModule, FormBuilder, Validators } from '@angular/forms';
import { Button } from 'primeng/button';
import { MessageInfo } from './message-info.model';
import { Message } from 'primeng/message';
import { ForgotPasswordFormGroupType } from '@osf/features/auth/forgot-password/forgot-password-form-group.type';

@Component({
selector: 'osf-forgot-password',
Expand All @@ -18,15 +14,11 @@ import { Message } from 'primeng/message';
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]],
});
}
#fb = inject(FormBuilder);
forgotPasswordForm: ForgotPasswordFormGroupType = this.#fb.group({
email: ['', [Validators.required, Validators.email]],
});
message = signal<MessageInfo | null>(null);

onSubmit(): void {
// TODO: Implement password reset logic
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { FormControl, FormGroup } from '@angular/forms';

export type ResetPasswordFormGroupType = FormGroup<{
newPassword: FormControl;
confirmNewPassword: FormControl;
}>;
22 changes: 11 additions & 11 deletions src/app/features/auth/reset-password/reset-password.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,36 @@ <h2>Reset Password</h2>

<form [formGroup]="resetPasswordForm" (ngSubmit)="onSubmit()">
<div class="field">
<label for="password">New Password</label>
<label for="newPassword">New Password</label>
<p-password
id="password"
formControlName="password"
id="newPassword"
formControlName="newPassword"
[toggleMask]="true"
[feedback]="false"
autocomplete="new-password"
></p-password>

<osf-password-input-hint
[isError]="
resetPasswordForm.get('password')?.errors &&
resetPasswordForm.get('password')?.touched
resetPasswordForm.get('newPassword')?.errors &&
resetPasswordForm.get('newPassword')?.touched
"
/>
</div>

<div class="field">
<label for="confirmPassword">Confirm New Password</label>
<label for="confirmNewPassword">Confirm New Password</label>
<p-password
id="confirmPassword"
formControlName="confirmPassword"
id="confirmNewPassword"
formControlName="confirmNewPassword"
[toggleMask]="true"
[feedback]="false"
autocomplete="new-password"
></p-password>
@if (
resetPasswordForm.get("confirmPassword")?.errors?.[
resetPasswordForm.get("confirmNewPassword")?.errors?.[
"passwordMismatch"
] && resetPasswordForm.get("confirmPassword")?.touched
] && resetPasswordForm.get("confirmNewPassword")?.touched
) {
<small class="text-danger">Passwords must match</small>
}
Expand All @@ -43,7 +43,7 @@ <h2>Reset Password</h2>
class="btn-full-width"
type="submit"
label="Reset Password"
[disabled]="!resetPasswordForm.valid"
[disabled]="resetPasswordForm.invalid"
></p-button>
</form>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
color: var.$pr-blue-1;
font-weight: 600;
}

.btn-full-width {
margin-top: 1.5rem;
}
}
}
}
48 changes: 18 additions & 30 deletions src/app/features/auth/reset-password/reset-password.component.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import { Component, inject, OnInit, signal } from '@angular/core';
import { Component, inject, signal } from '@angular/core';
import { Button } from 'primeng/button';
import {
FormBuilder,
FormGroup,
ReactiveFormsModule,
Validators,
} from '@angular/forms';
import { FormBuilder, 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';
import { ResetPasswordFormGroupType } from './reset-password-form-group.type';

@Component({
selector: 'osf-reset-password',
Expand All @@ -27,31 +23,23 @@ import { PasswordInputHintComponent } from '@shared/components/password-input-hi
templateUrl: './reset-password.component.html',
styleUrl: './reset-password.component.scss',
})
export class ResetPasswordComponent implements OnInit {
private fb = inject(FormBuilder);
passwordRegex: RegExp = PASSWORD_REGEX;
resetPasswordForm: FormGroup = new FormGroup({});
export class ResetPasswordComponent {
#fb = inject(FormBuilder);
passwordRegex = PASSWORD_REGEX;
resetPasswordForm: ResetPasswordFormGroupType = this.#fb.group(
{
newPassword: [
'',
[Validators.required, Validators.pattern(this.passwordRegex)],
],
confirmNewPassword: ['', Validators.required],
},
{
validators: passwordMatchValidator(),
},
);
isFormSubmitted = signal(false);

ngOnInit(): void {
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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, input } from '@angular/core';
import { BooleanOrNullOrUndefined } from '@core/helpers/types.helper';

@Component({
selector: 'osf-password-input-hint',
Expand All @@ -7,5 +8,5 @@ import { Component, input } from '@angular/core';
styleUrl: './password-input-hint.component.scss',
})
export class PasswordInputHintComponent {
isError = input<boolean | null | undefined>(false);
isError = input<BooleanOrNullOrUndefined>(false);
}