Skip to content

Commit

Permalink
fix: Fixes a bug and contains minor css changes (#3358)
Browse files Browse the repository at this point in the history
  • Loading branch information
bistaastha authored Dec 19, 2024
1 parent 1fbec62 commit 5dcc9f9
Show file tree
Hide file tree
Showing 13 changed files with 76 additions and 69 deletions.
12 changes: 10 additions & 2 deletions src/app/auth/new-password/new-password.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<input
placeholder="Re-enter password"
[required]="true"
[type]="hideConfirmPassword ? 'text': 'password'"
[type]="hideConfirmPassword ? 'password' : 'text'"
class="new-password__text-input smartlook-show"
formControlName="confirmPassword"
/>
Expand Down Expand Up @@ -96,7 +96,15 @@
</div>
</div>
<div *ngIf="fg">
<ion-button (click)="changePassword()" class="btn-primary" fill="clear" [disabled]="!fg.valid">
<ion-button
(click)="changePassword()"
class="btn-primary"
fill="clear"
[disabled]="!fg.valid"
appFormButtonValidation
[loading]="isLoading"
[loadingText]="'Resetting'"
>
Reset password
</ion-button>
<div class="new-password__cta-secondary" (click)="redirectToSignIn()">
Expand Down
2 changes: 1 addition & 1 deletion src/app/auth/new-password/new-password.page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
}

&__back-icon {
margin-bottom: 20px;
margin-bottom: 16px;
width: 28px;
height: 28px;
}
Expand Down
9 changes: 7 additions & 2 deletions src/app/auth/new-password/new-password.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export class NewPasswordPage implements OnInit {

showPasswordTooltip = false;

isLoading = false;

constructor(
private fb: FormBuilder,
private activatedRoute: ActivatedRoute,
Expand All @@ -62,7 +64,7 @@ export class NewPasswordPage implements OnInit {

changePassword(): void {
const refreshToken = this.activatedRoute.snapshot.params.refreshToken as string;

this.isLoading = true;
from(this.loaderService.showLoader())
.pipe(
switchMap(() => this.routerAuthService.resetPassword(refreshToken, this.fg.controls.password.value as string)),
Expand All @@ -73,7 +75,10 @@ export class NewPasswordPage implements OnInit {
this.trackingService.resetPassword();
await this.trackLoginInfo();
}),
finalize(() => from(this.loaderService.hideLoader()))
finalize(() => {
this.isLoading = false;
return from(this.loaderService.hideLoader());
})
)
.subscribe(
() => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/auth/reset-password/reset-password.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>
</div>
<form [formGroup]="fg" class="forgot-password__input-container">
<div class="forgot-password__input-container__label">Registered Email</div>
<div class="forgot-password__input-container__label">Registered email</div>
<input
#simpleEmailInput
matInput
Expand Down
7 changes: 6 additions & 1 deletion src/app/auth/reset-password/reset-password.page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ describe('ResetPasswordPage', () => {

it('onGotoSignInClick(): should navigate to sign-in page', () => {
component.onGotoSignInClick();
expect(router.navigate).toHaveBeenCalledWith(['/', 'auth', 'sign_in']);
expect(router.navigate).toHaveBeenCalledWith([
'/',
'auth',
'sign_in',
{ email: component.fg.controls.email.value },
]);
});
});
2 changes: 1 addition & 1 deletion src/app/auth/reset-password/reset-password.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ export class ResetPasswordPage {
}

onGotoSignInClick(): void {
this.router.navigate(['/', 'auth', 'sign_in']);
this.router.navigate(['/', 'auth', 'sign_in', { email: this.fg.controls.email.value as string }]);
}
}
2 changes: 1 addition & 1 deletion src/app/auth/sign-in/error/error.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}

&__details {
font-size: 16px;
font-size: 14px;
padding: 20px 16px;
color: $black;
}
Expand Down
16 changes: 8 additions & 8 deletions src/app/auth/sign-in/sign-in.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
<div class="sign-in__enter-email" *ngIf="currentStep === signInPageState.ENTER_EMAIL">
<div>
<ion-icon
class="fy-icon sign-in__enter-email__back-icon"
class="fy-icon sign-in__back-icon"
src="/assets/svg/arrow-tail-left.svg"
(click)="changeState(signInPageState.SELECT_SIGN_IN_METHOD)"
></ion-icon>
<div class="sign-in__enter-email__form-container">
<div>
<div class="sign-in__enter-email__page-header">Sign in</div>
<div class="sign-in__enter-email__sub-header">Enter the credentials to access your account</div>
<div class="sign-in__page-header">Sign in</div>
<div class="sign-in__sub-header">Enter the credentials to access your account</div>
</div>
<form [formGroup]="fg" class="sign-in__enter-email__input-container">
<div class="sign-in__enter-email__input-container__label">Registered email</div>
Expand Down Expand Up @@ -85,14 +85,14 @@
<div class="sign-in__enter-password" *ngIf="currentStep === signInPageState.ENTER_PASSWORD">
<div>
<ion-icon
class="fy-icon sign-in__enter-email__back-icon"
class="fy-icon sign-in__back-icon"
src="/assets/svg/arrow-tail-left.svg"
(click)="changeState(signInPageState.ENTER_EMAIL)"
></ion-icon>
<div class="sign-in__enter-password__form-container">
<div>
<div class="sign-in__enter-password__page-header">Sign in</div>
<div class="sign-in__enter-password__sub-header">Enter the credentials to access your account</div>
<div class="sign-in__page-header">Sign in</div>
<div class="sign-in__sub-header">Enter the credentials to access your account</div>
</div>
<form [formGroup]="fg" class="sign-in__enter-password__input-container">
<div class="sign-in__enter-password__input-container__label">Registered email</div>
Expand All @@ -111,7 +111,7 @@
<div class="sign-in__enter-password__input-container__label">Password</div>
<div class="sign-in__enter-password__password-container">
<input
placeholder="Re-enter password"
placeholder="Enter password"
[required]="true"
[type]="hidePassword ? 'password': 'text'"
class="sign-in__enter-password__text-input smartlook-show"
Expand Down Expand Up @@ -151,7 +151,7 @@
(click)="signInUser()"
appFormButtonValidation
[loading]="passwordLoading"
[loadingText]="'Signing In'"
[loadingText]="'Signing in'"
>
Sign in
</ion-button>
Expand Down
63 changes: 27 additions & 36 deletions src/app/auth/sign-in/sign-in.page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,29 @@
}
}

&__page-header {
font-size: 20px;
margin: 0 0 10px;
position: relative;
margin-bottom: 6px;
font-weight: 500;
}

&__back-icon {
margin-bottom: 16px;
width: 28px;
height: 28px;
}

&__sub-header {
font-size: 14px;
margin: 0 0 10px;
position: relative;
margin-bottom: 32px;
color: $black-light;
line-height: 1.28;
}

&__select-sign-in {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -44,7 +67,7 @@
}

&__enter-email {
height: 100%;
height: 96vh;
margin-top: 18px;
padding: 20px;
padding: 28px 20px 44px 20px;
Expand Down Expand Up @@ -84,30 +107,10 @@
&__disabled {
opacity: 0.2;
}

&__sub-header {
font-size: 14px;
margin: 0 0 10px;
position: relative;
margin-bottom: 32px;
color: $black-light;
line-height: 1.28;
}
&__page-header {
font-size: 20px;
margin: 0 0 10px;
position: relative;
margin-bottom: 8px;
}
&__back-icon {
margin-bottom: 20px;
width: 28px;
height: 28px;
}
}

&__enter-password {
height: 100%;
height: 96vh;
margin-top: 18px;
padding: 20px;
padding: 28px 20px 44px 20px;
Expand All @@ -116,9 +119,6 @@
justify-content: space-between;

&__forgot-password {
color: $black-light;
font-size: 12px;
font-style: normal;
line-height: 1.5;
float: right;
margin-top: 1px;
Expand All @@ -127,6 +127,8 @@
&__forgot-password_button {
font-weight: 500;
background: $pure-white;
color: $black-light;
font-size: 12px;
}

&__disabled-email {
Expand Down Expand Up @@ -233,17 +235,6 @@
color: $black-light;
line-height: 1.28;
}
&__page-header {
font-size: 20px;
margin: 0 0 10px;
position: relative;
margin-bottom: 8px;
}
&__back-icon {
margin-bottom: 20px;
width: 28px;
height: 28px;
}
}

&__secondary-cta {
Expand Down
14 changes: 3 additions & 11 deletions src/app/auth/sign-in/sign-in.page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ describe('SignInPage', () => {
component.checkIfEmailExists();
expect(component.handleSamlSignIn).toHaveBeenCalledOnceWith({ saml: true });
expect(routerAuthService.checkEmailExists).toHaveBeenCalledOnceWith(component.fg.controls.email.value);
expect(component.emailSet).toBeFalse();
expect(component.emailLoading).toBeFalse();
done();
});
Expand Down Expand Up @@ -443,15 +442,6 @@ describe('SignInPage', () => {
});
});

it('ionViewWillEnter(): should set email', () => {
expect(component.emailSet).toBeFalse();

component.fg.controls.email.setValue('email');

component.ionViewWillEnter();
expect(component.emailSet).toBeTrue();
});

describe('ngOnInit(): ', () => {
it('should navigate to switch org page if logged in ', fakeAsync(() => {
loaderService.showLoader.and.resolveTo();
Expand Down Expand Up @@ -495,9 +485,11 @@ describe('SignInPage', () => {
});

it('should sign in with google when clicking on the SIGN IN WITH GOOGLE button', () => {
component.currentStep = SignInPageState.SELECT_SIGN_IN_METHOD;
spyOn(component, 'googleSignIn');
const googleButton = getElementBySelector(fixture, '.sign-in__secondary-cta__btn') as HTMLElement;
fixture.detectChanges();

const googleButton = getElementBySelector(fixture, '.sign-in__secondary-cta__btn') as HTMLElement;
click(googleButton);
expect(component.googleSignIn).toHaveBeenCalledTimes(1);
});
Expand Down
10 changes: 6 additions & 4 deletions src/app/auth/sign-in/sign-in.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import { SignInPageState } from './sign-in-page-state.enum';
export class SignInPage implements OnInit {
fg: FormGroup;

emailSet = false;

emailLoading = false;

passwordLoading = false;
Expand All @@ -38,7 +36,7 @@ export class SignInPage implements OnInit {

checkEmailExists$: Observable<EmailExistsResponse>;

currentStep: SignInPageState = SignInPageState.SELECT_SIGN_IN_METHOD;
currentStep: SignInPageState;

signInPageState: typeof SignInPageState = SignInPageState;

Expand Down Expand Up @@ -263,7 +261,11 @@ export class SignInPage implements OnInit {
}

ionViewWillEnter(): void {
this.emailSet = !!this.fg.controls.email.value;
if (this.activatedRoute.snapshot.params.email) {
this.currentStep = SignInPageState.ENTER_PASSWORD;
} else {
this.currentStep = SignInPageState.SELECT_SIGN_IN_METHOD;
}
}

changeState(state: SignInPageState): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
}

&__back-icon {
margin-bottom: 20px;
margin-bottom: 16px;
width: 28px;
height: 28px;
}
Expand Down
4 changes: 4 additions & 0 deletions src/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ ion-popover.error-popover {
stroke: $black-light;
}

.intermediate-loader .loading-wrapper .loading-spinner ion-spinner {
color: $brand-primary;
}

ion-popover.dialog-popover {
&::part(content) {
bottom: 0 !important;
Expand Down

0 comments on commit 5dcc9f9

Please sign in to comment.