some renamings, added remember me checkbox and forgot password text (inoop)

This commit is contained in:
Igor Hrenowitsch Propisnov 2024-06-26 15:37:15 +02:00
parent 67b7ca3922
commit 7f0ed041cc
5 changed files with 48 additions and 6 deletions

View File

@ -9,7 +9,7 @@ const publicRoutes: Routes = [
), ),
}, },
{ {
path: 'signup', path: 'welcome',
loadComponent: () => loadComponent: () =>
import('./pages/register-root/register-root.component').then( import('./pages/register-root/register-root.component').then(
(m) => m.RegisterRootComponent (m) => m.RegisterRootComponent

View File

@ -15,7 +15,7 @@
the application shortly. the application shortly.
</p> </p>
<button <button
(click)="navigateToSignup()" (click)="navigateToWelcomeScreen()"
class="btn btn-primary no-animation"> class="btn btn-primary no-animation">
Go to the App Go to the App
</button> </button>

View File

@ -56,10 +56,10 @@ export class EmailVerifyRootComponent implements OnInit {
this.backgroundStyle = { 'background-image': `url("${svgUrl}")` }; this.backgroundStyle = { 'background-image': `url("${svgUrl}")` };
} }
public navigateToSignup(): void { public navigateToWelcomeScreen(): void {
const email: string = this.extractEmail(); const email: string = this.extractEmail();
this.router.navigate(['/signup'], { this.router.navigate(['/welcome'], {
queryParams: { verified: true, email: email }, queryParams: { verified: true, email: email },
}); });
} }
@ -96,7 +96,7 @@ export class EmailVerifyRootComponent implements OnInit {
delay(10000) delay(10000)
) )
.subscribe(() => { .subscribe(() => {
this.navigateToSignup(); this.navigateToWelcomeScreen();
}); });
} }
} }

View File

@ -239,6 +239,9 @@
</label> </label>
</div> </div>
<button class="btn w-full btn-primary font-semibold"> <button class="btn w-full btn-primary font-semibold">
@if (isLoading()) {
<span class="loading loading-spinner"></span>
}
Sign In with Email Sign In with Email
</button> </button>
<p class="text-xs w-full text-center"> <p class="text-xs w-full text-center">
@ -312,9 +315,36 @@
value="" /> value="" />
</label> </label>
</div> </div>
<div class="form-control w-full">
<div class="flex items-center justify-between">
<label class="label cursor-pointer">
<input
type="checkbox"
checked="checked"
class="checkbox checkbox-md checkbox-primary" />
<span class="label-text ml-1.5">Remember me</span>
</label>
<a class="text-primary label-text cursor-pointer">
Forgot password?
</a>
</div>
</div>
<button class="btn w-full btn-primary font-semibold"> <button class="btn w-full btn-primary font-semibold">
@if (isLoading()) {
<span class="loading loading-spinner"></span>
}
Sign In Sign In
</button> </button>
<div class="flex gap-1">
<span class="text-xs">Not registered yet?</span>
<a
(click)="toggleAction('signup')"
(keypress)="toggleAction('signup')"
tabindex="0"
class="text-primary cursor-pointer text-xs">
Create An Account
</a>
</div>
</form> </form>
</div> </div>
} }

View File

@ -25,6 +25,7 @@ import { ButtonModule } from 'primeng/button';
import { CheckboxModule } from 'primeng/checkbox'; import { CheckboxModule } from 'primeng/checkbox';
import { InputTextModule } from 'primeng/inputtext'; import { InputTextModule } from 'primeng/inputtext';
import { PasswordModule } from 'primeng/password'; import { PasswordModule } from 'primeng/password';
import { delay, finalize, tap } from 'rxjs';
import { import {
Configuration, Configuration,
@ -80,6 +81,7 @@ export class RegisterRootComponent implements OnInit {
public isSignupSignal: WritableSignal<boolean> = signal(true); public isSignupSignal: WritableSignal<boolean> = signal(true);
public userSignupSuccess: WritableSignal<boolean> = signal(false); public userSignupSuccess: WritableSignal<boolean> = signal(false);
public isDialogOpen: WritableSignal<boolean> = signal(false); public isDialogOpen: WritableSignal<boolean> = signal(false);
public isLoading: WritableSignal<boolean> = signal(false);
private removeQueryParams: WritableSignal<boolean> = signal(false); private removeQueryParams: WritableSignal<boolean> = signal(false);
public get isDarkMode(): boolean { public get isDarkMode(): boolean {
@ -183,7 +185,6 @@ export class RegisterRootComponent implements OnInit {
private handleRedirect(): void { private handleRedirect(): void {
if (this.verified()) { if (this.verified()) {
//this.isDisplayButtons.set(false);
this.isSigninSignal.set(true); this.isSigninSignal.set(true);
this.isSignupSignal.set(false); this.isSignupSignal.set(false);
} }
@ -276,6 +277,11 @@ export class RegisterRootComponent implements OnInit {
private signin(logiCredentials: UserCredentialsDtoApiModel): void { private signin(logiCredentials: UserCredentialsDtoApiModel): void {
this.authService this.authService
.signin(logiCredentials) .signin(logiCredentials)
.pipe(
tap(() => this.isLoading.set(true)),
delay(1000),
finalize(() => this.isLoading.set(false))
)
.subscribe((response: SigninResponseDtoApiModel) => { .subscribe((response: SigninResponseDtoApiModel) => {
if (response) { if (response) {
this.router.navigate(['/dashboard']); this.router.navigate(['/dashboard']);
@ -284,8 +290,14 @@ export class RegisterRootComponent implements OnInit {
} }
private signup(logiCredentials: UserCredentialsDtoApiModel): void { private signup(logiCredentials: UserCredentialsDtoApiModel): void {
this.isLoading.set(true);
this.authService this.authService
.signup(logiCredentials) .signup(logiCredentials)
.pipe(
delay(1000),
tap(() => this.isLoading.set(true)),
finalize(() => this.isLoading.set(false))
)
.subscribe((response: SuccessDtoApiModel) => { .subscribe((response: SuccessDtoApiModel) => {
if (response.success) { if (response.success) {
this.openModal(); this.openModal();