@rtsee/ngx 0.0.57 → 0.0.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/package.json +10 -7
- package/projects/ngx/src/lib/common/interfaces/index.ts +1 -0
- package/projects/ngx/src/lib/common/interfaces/server-errors.ts +5 -0
- package/projects/ngx/src/lib/components/rtsee-auth/auth/auth.component.html +14 -10
- package/projects/ngx/src/lib/components/rtsee-auth/auth/auth.component.ts +28 -2
- package/projects/ngx/src/lib/components/rtsee-auth/forgot-password/forgot-password.component.html +1 -1
- package/projects/ngx/src/lib/components/rtsee-auth/forgot-password/forgot-password.component.ts +12 -5
- package/projects/ngx/src/lib/components/rtsee-auth/reset-password/reset-password.component.ts +6 -2
- package/projects/ngx/src/lib/components/rtsee-auth/services/auth.service.ts +40 -0
- package/projects/ngx/src/lib/components/rtsee-auth/sign-in/sign-in.component.html +66 -28
- package/projects/ngx/src/lib/components/rtsee-auth/sign-in/sign-in.component.ts +96 -20
- package/projects/ngx/src/lib/components/rtsee-auth/sign-up/sign-up.component.html +1 -1
- package/projects/ngx/src/lib/components/rtsee-auth/sign-up/sign-up.component.ts +18 -2
- package/projects/ngx/src/lib/components/rtsee-auth/types/auth-form.type.ts +3 -3
- package/projects/ngx/src/lib/components/rtsee-container/rtsee-container.component.html +25 -29
- package/projects/ngx/src/lib/components/rtsee-container/rtsee-container.component.ts +5 -8
- package/projects/ngx/src/lib/components/rtsee-container/rtsee-nav/rtsee-nav.component.html +25 -0
- package/projects/ngx/src/lib/components/rtsee-container/rtsee-nav/rtsee-nav.component.ts +26 -0
- package/projects/ngx/src/lib/components/rtsee-presentation/presentation/presentation.component.html +18 -17
- package/projects/ngx/src/lib/components/rtsee-presentation/presentation/presentation.component.ts +0 -2
- package/projects/ngx/src/lib/components/rtsee-presentation/slide/slide.component.html +22 -18
- package/projects/ngx/src/lib/components/rtsee-presentation/slide/slide.component.ts +4 -3
- package/projects/ngx/src/lib/ngx.module.ts +17 -9
- package/projects/ngx/src/lib/theme/auth/auth-container.scss +189 -177
- package/projects/ngx/src/lib/theme/auth/index.scss +0 -1
- package/projects/ngx/src/lib/theme/auth/variables.scss +1 -64
- package/projects/ngx/src/lib/theme/common-variables.scss +1 -0
- package/projects/ngx/src/lib/theme/containers/index.scss +2 -2
- package/projects/ngx/src/lib/theme/containers/nav-item.scss +84 -55
- package/projects/ngx/src/lib/theme/containers/nav.scss +86 -0
- package/projects/ngx/src/lib/theme/containers/shell.scss +22 -31
- package/projects/ngx/src/lib/theme/containers/variables.scss +10 -1
- package/projects/ngx/src/lib/theme/forms/common.scss +51 -0
- package/projects/ngx/src/lib/theme/forms/index.scss +1 -0
- package/projects/ngx/src/lib/theme/forms/variables.scss +8 -0
- package/projects/ngx/src/lib/theme/styles.scss +1 -0
- package/tsconfig.json +2 -5
- package/projects/ngx/src/lib/components/rtsee-container/rtsee-bottom-nav/rtsee-bottom-nav.component.html +0 -15
- package/projects/ngx/src/lib/components/rtsee-container/rtsee-bottom-nav/rtsee-bottom-nav.component.ts +0 -20
- package/projects/ngx/src/lib/components/rtsee-container/rtsee-sidenav/rtsee-sidenav.component.html +0 -32
- package/projects/ngx/src/lib/components/rtsee-container/rtsee-sidenav/rtsee-sidenav.component.ts +0 -26
- package/projects/ngx/src/lib/theme/auth/auth.scss +0 -0
- package/projects/ngx/src/lib/theme/containers/bottom-nav.scss +0 -15
- package/projects/ngx/src/lib/theme/containers/sidenav.scss +0 -125
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 0.0.59 (2025-09-21)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @rtsee/ngx
|
|
9
|
+
|
|
10
|
+
## 0.0.58 (2025-08-11)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @rtsee/ngx
|
|
13
|
+
|
|
6
14
|
## 0.0.57 (2025-07-23)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @rtsee/ngx
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.59",
|
|
3
3
|
"name": "@rtsee/ngx",
|
|
4
4
|
"module": "./dist/ngx/fesm2022/rtsee-ngx.mjs",
|
|
5
5
|
"types": "./dist/ngx/index.d.ts",
|
|
@@ -30,15 +30,18 @@
|
|
|
30
30
|
"@angular/platform-browser": "~20.1.2",
|
|
31
31
|
"@angular/platform-browser-dynamic": "~20.1.2",
|
|
32
32
|
"@angular/router": "~20.1.2",
|
|
33
|
-
"@
|
|
34
|
-
"@rtsee/
|
|
35
|
-
"@rtsee/
|
|
36
|
-
"@rtsee/
|
|
37
|
-
"@rtsee/
|
|
33
|
+
"@primeuix/themes": "^1.2.3",
|
|
34
|
+
"@rtsee/common": "^0.0.29",
|
|
35
|
+
"@rtsee/conference": "^0.0.30",
|
|
36
|
+
"@rtsee/events-dashboard": "^0.0.63",
|
|
37
|
+
"@rtsee/factory": "^0.0.72",
|
|
38
|
+
"@rtsee/messenger": "^0.0.63",
|
|
38
39
|
"@rtsee/signaling-client": "^0.0.66",
|
|
39
40
|
"dayjs": "^1.11.9",
|
|
40
41
|
"ngx-autosize": "^2.0.4",
|
|
42
|
+
"ngx-captcha": "^14.0.0",
|
|
41
43
|
"ngx-infinite-scroll": "20.0.0",
|
|
44
|
+
"primeng": "^20.1.2",
|
|
42
45
|
"rxjs": "~7.8.0",
|
|
43
46
|
"shave": "^5.0.0",
|
|
44
47
|
"swiper": "^11.1.15",
|
|
@@ -58,5 +61,5 @@
|
|
|
58
61
|
"publishConfig": {
|
|
59
62
|
"access": "public"
|
|
60
63
|
},
|
|
61
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "07cce216164a8c6a5639bf0e54e8ad7f71c9d6db"
|
|
62
65
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './server-errors';
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
<div class="rtsee-auth">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
@if (authService.rtseeAuth) {
|
|
3
|
+
@if (activeComponent === 'sign-in') {
|
|
4
|
+
<rtsee-sign-in></rtsee-sign-in>
|
|
5
|
+
}
|
|
6
|
+
@if (activeComponent === 'sign-up') {
|
|
7
|
+
<rtsee-sign-up></rtsee-sign-up>
|
|
8
|
+
}
|
|
9
|
+
@if (activeComponent === 'forgot-password') {
|
|
10
|
+
<rtsee-forgot-password></rtsee-forgot-password>
|
|
11
|
+
}
|
|
12
|
+
@if (activeComponent === 'reset-password') {
|
|
13
|
+
<rtsee-reset-password *ngIf="activeComponent === 'reset-password'"></rtsee-reset-password>
|
|
14
|
+
}
|
|
15
|
+
}
|
|
12
16
|
</div>
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Component, Input, OnInit} from '@angular/core';
|
|
2
2
|
import {SignInComponent} from "../sign-in/sign-in.component";
|
|
3
3
|
import {SignUpComponent} from "../sign-up/sign-up.component";
|
|
4
4
|
import {ForgotPasswordComponent} from "../forgot-password/forgot-password.component";
|
|
5
5
|
import {ResetPasswordComponent} from "../reset-password/reset-password.component";
|
|
6
6
|
import {NgIf} from "@angular/common";
|
|
7
|
+
import {RTSeeAuthService} from "../services/auth.service";
|
|
8
|
+
import {RTSeeAuth} from "@rtsee/auth";
|
|
9
|
+
import {AuthEndpointsKeys, DEFAULT_ROUTE_NAMES} from "@rtsee/auth";
|
|
7
10
|
|
|
8
11
|
@Component({
|
|
9
12
|
selector: 'rtsee-auth',
|
|
@@ -17,6 +20,29 @@ import {NgIf} from "@angular/common";
|
|
|
17
20
|
],
|
|
18
21
|
standalone: true
|
|
19
22
|
})
|
|
20
|
-
export class
|
|
23
|
+
export class RTSeeAuthComponent implements OnInit {
|
|
24
|
+
@Input() auth!: RTSeeAuth<any>;
|
|
25
|
+
|
|
21
26
|
activeComponent: 'reset-password' | 'sign-up' | 'sign-in' | 'forgot-password' = 'sign-in' ;
|
|
27
|
+
|
|
28
|
+
constructor(public authService: RTSeeAuthService) {
|
|
29
|
+
console.log('constructor', window.location.pathname);
|
|
30
|
+
|
|
31
|
+
if (window.location.pathname.includes(DEFAULT_ROUTE_NAMES[AuthEndpointsKeys.SIGN_IN])) {
|
|
32
|
+
this.activeComponent = 'sign-in';
|
|
33
|
+
} else if (window.location.pathname.includes(DEFAULT_ROUTE_NAMES[AuthEndpointsKeys.SIGN_UP])) {
|
|
34
|
+
this.activeComponent = 'sign-up';
|
|
35
|
+
} else if (window.location.pathname.includes(DEFAULT_ROUTE_NAMES[AuthEndpointsKeys.FORGOT_PASSWORD])) {
|
|
36
|
+
this.activeComponent = 'forgot-password';
|
|
37
|
+
} else if (
|
|
38
|
+
window.location.pathname
|
|
39
|
+
.includes(DEFAULT_ROUTE_NAMES[AuthEndpointsKeys.RESET_PASSWORD].split('/')[0])
|
|
40
|
+
) {
|
|
41
|
+
this.activeComponent = 'reset-password';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
ngOnInit() {
|
|
46
|
+
this.authService.init(this.auth);
|
|
47
|
+
}
|
|
22
48
|
}
|
package/projects/ngx/src/lib/components/rtsee-auth/forgot-password/forgot-password.component.html
CHANGED
|
@@ -30,6 +30,6 @@
|
|
|
30
30
|
|
|
31
31
|
<!-- Redirect to Sign-In -->
|
|
32
32
|
<p class="auth-media-blue-gray-sm-normal">
|
|
33
|
-
Пам'ятаєте пароль? <a [routerLink]="
|
|
33
|
+
Пам'ятаєте пароль? <a [routerLink]="authConfiguration.getRoutePathSplit(AuthEndpointsKeys.SIGN_IN)" class="auth-deep-blue-sm-medium">Увійдіть</a>
|
|
34
34
|
</p>
|
|
35
35
|
</div>
|
package/projects/ngx/src/lib/components/rtsee-auth/forgot-password/forgot-password.component.ts
CHANGED
|
@@ -3,6 +3,8 @@ import {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from '@angular/
|
|
|
3
3
|
import { UtilsService } from '../services/utils.service';
|
|
4
4
|
import { ForgotPasswordForm, TypedReactiveForm } from '../types/auth-form.type';
|
|
5
5
|
import {RouterLink} from "@angular/router";
|
|
6
|
+
import { RTSeeAuthConfiguration, AuthEndpointsKeys } from "@rtsee/auth";
|
|
7
|
+
import { RTSeeAuthService } from "../services/auth.service";
|
|
6
8
|
|
|
7
9
|
@Component({
|
|
8
10
|
selector: 'rtsee-forgot-password',
|
|
@@ -17,19 +19,24 @@ export class ForgotPasswordComponent {
|
|
|
17
19
|
public isLoading: boolean = false;
|
|
18
20
|
public readonly emailForm: FormGroup<TypedReactiveForm<ForgotPasswordForm>>;
|
|
19
21
|
public readonly forgotPasswordFormKeys: Record<keyof ForgotPasswordForm, string>;
|
|
22
|
+
authConfiguration: RTSeeAuthConfiguration;
|
|
23
|
+
|
|
20
24
|
constructor(
|
|
21
|
-
private readonly formBuilder: FormBuilder
|
|
25
|
+
private readonly formBuilder: FormBuilder,
|
|
26
|
+
private authService: RTSeeAuthService
|
|
22
27
|
) {
|
|
23
|
-
|
|
24
|
-
email: this.formBuilder.control(
|
|
28
|
+
this.emailForm= this.formBuilder.group<TypedReactiveForm<ForgotPasswordForm>>({
|
|
29
|
+
email: this.formBuilder.nonNullable.control('', { validators: [Validators.required, Validators.email] }),
|
|
25
30
|
});
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
this.forgotPasswordFormKeys = UtilsService.getKeysAsValueObject(this.emailForm.getRawValue());
|
|
32
|
+
this.authConfiguration = this.authService.rtseeAuth.authConfiguration;
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
public submitEmail(): void {
|
|
31
36
|
if (this.emailForm.valid) {
|
|
32
37
|
}
|
|
33
38
|
}
|
|
39
|
+
|
|
40
|
+
protected readonly AuthEndpointsKeys = AuthEndpointsKeys;
|
|
34
41
|
}
|
|
35
42
|
|
package/projects/ngx/src/lib/components/rtsee-auth/reset-password/reset-password.component.ts
CHANGED
|
@@ -2,9 +2,11 @@ import { Component, OnInit } from '@angular/core';
|
|
|
2
2
|
import {FormBuilder, FormGroup, ReactiveFormsModule, ValidatorFn, Validators} from '@angular/forms';
|
|
3
3
|
import { ResetPasswordForm, TypedReactiveForm } from '../types/auth-form.type';
|
|
4
4
|
import { UtilsService } from '../services/utils.service';
|
|
5
|
-
import { ActivatedRoute
|
|
5
|
+
import { ActivatedRoute } from '@angular/router';
|
|
6
6
|
import { FormErrorKey } from '../../enums/form.enum';
|
|
7
7
|
import { COMMON_CONSTANTS } from '../../constans/common.const';
|
|
8
|
+
import { RTSeeAuthService } from "../services/auth.service";
|
|
9
|
+
import { RTSeeAuthConfiguration } from "@rtsee/auth";
|
|
8
10
|
|
|
9
11
|
@Component({
|
|
10
12
|
selector: 'rtsee-reset-password',
|
|
@@ -23,17 +25,19 @@ export class ResetPasswordComponent implements OnInit {
|
|
|
23
25
|
passwordConfirm: true
|
|
24
26
|
};
|
|
25
27
|
private token!: string;
|
|
28
|
+
authConfiguration: RTSeeAuthConfiguration;
|
|
26
29
|
|
|
27
30
|
constructor(
|
|
28
31
|
private formBuilder: FormBuilder,
|
|
29
32
|
private route: ActivatedRoute,
|
|
30
|
-
private
|
|
33
|
+
private authService: RTSeeAuthService
|
|
31
34
|
) {
|
|
32
35
|
this.resetPasswordForm = this.formBuilder.group({
|
|
33
36
|
password: this.formBuilder.control('', {validators: [Validators.required, Validators.minLength(COMMON_CONSTANTS.minPasswordLength)], nonNullable: true}),
|
|
34
37
|
passwordConfirm: this.formBuilder.control('', {validators: [Validators.required, Validators.minLength(COMMON_CONSTANTS.minPasswordLength)], nonNullable: true}),
|
|
35
38
|
}, {validators: [this.passwordMatchValidator()]});
|
|
36
39
|
this.passwordFormKeys = UtilsService.getKeysAsValueObject(this.resetPasswordForm.value);
|
|
40
|
+
this.authConfiguration = this.authService.authConfiguration;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
public ngOnInit(): void {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import {HttpClient} from "@angular/common/http";
|
|
3
|
+
import {
|
|
4
|
+
RTSeeAuth,
|
|
5
|
+
IRtseeSignInRequestOptions,
|
|
6
|
+
IRTSeeSignInResponse,
|
|
7
|
+
IRtseeSignUpRequestOptions,
|
|
8
|
+
IRTSeeSignUpResponse,
|
|
9
|
+
AuthEndpointsKeys,
|
|
10
|
+
RTSeeAuthConfiguration
|
|
11
|
+
} from "@rtsee/auth";
|
|
12
|
+
import { Observable, tap } from "rxjs";
|
|
13
|
+
|
|
14
|
+
@Injectable({
|
|
15
|
+
providedIn: 'root'
|
|
16
|
+
})
|
|
17
|
+
export class RTSeeAuthService {
|
|
18
|
+
rtseeAuth!: RTSeeAuth<any>;
|
|
19
|
+
authConfiguration!: RTSeeAuthConfiguration;
|
|
20
|
+
|
|
21
|
+
constructor(
|
|
22
|
+
private http: HttpClient,
|
|
23
|
+
) {}
|
|
24
|
+
|
|
25
|
+
init(auth: RTSeeAuth<any>) {
|
|
26
|
+
this.rtseeAuth = auth;
|
|
27
|
+
this.authConfiguration = this.rtseeAuth.authConfiguration;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
signIn(credentials: IRtseeSignInRequestOptions): Observable<IRTSeeSignInResponse> {
|
|
31
|
+
return this.http
|
|
32
|
+
.post<IRTSeeSignInResponse>(this.authConfiguration.getEndpointPathByEndpointName(AuthEndpointsKeys.SIGN_IN), credentials)
|
|
33
|
+
.pipe(tap((res) => this.rtseeAuth.authenticate(res)))
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
signUp(credentials: IRtseeSignUpRequestOptions): Observable<IRTSeeSignUpResponse> {
|
|
37
|
+
return this.http
|
|
38
|
+
.post<IRTSeeSignUpResponse>(this.authConfiguration.getEndpointPathByEndpointName(AuthEndpointsKeys.SIGN_UP), credentials)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,45 +1,83 @@
|
|
|
1
|
-
<div class="auth-container">
|
|
2
|
-
<img ngSrc="
|
|
1
|
+
<div class="auth-container rtsee-form-container" >
|
|
2
|
+
<img [ngSrc]="authConfiguration.appLogo"
|
|
3
3
|
alt="Company Logo"
|
|
4
4
|
class="auth-logo"
|
|
5
|
-
height="
|
|
5
|
+
height="37"
|
|
6
6
|
width="37"
|
|
7
7
|
/>
|
|
8
8
|
<h2 class="auth-title">Вхід в Особистий Кабінет</h2>
|
|
9
9
|
<p class="auth-title-description">Аби переглядати казки, увійдіть в свій особистий кабінет</p>
|
|
10
10
|
|
|
11
|
-
<form class="auth-form" [formGroup]="signInForm" (ngSubmit)="login()">
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<
|
|
11
|
+
<form class="auth-form rtsee-form" [formGroup]="signInForm" (ngSubmit)="login()">
|
|
12
|
+
<div class="rtsee-form-field-container">
|
|
13
|
+
<p-inputgroup >
|
|
14
|
+
<p-floatlabel variant="on">
|
|
15
|
+
<input id="user-email"
|
|
16
|
+
pInputText
|
|
17
|
+
[formControl]="usernameField"
|
|
18
|
+
/>
|
|
19
|
+
<label for="user-email">Email</label>
|
|
20
|
+
</p-floatlabel>
|
|
21
|
+
</p-inputgroup>
|
|
22
|
+
@if (!usernameField.valid && usernameField.touched) {
|
|
23
|
+
<p-message class="rtsee-form-field-error-message"
|
|
24
|
+
severity="error"
|
|
25
|
+
variant="simple"
|
|
26
|
+
size="small"
|
|
27
|
+
>Email is invalid</p-message>
|
|
28
|
+
}
|
|
29
|
+
</div>
|
|
30
|
+
<div class="rtsee-form-field-container">
|
|
31
|
+
<p-inputgroup>
|
|
32
|
+
<p-floatlabel variant="on">
|
|
33
|
+
<p-password id="user-password"
|
|
34
|
+
[formControl]="passwordField"
|
|
35
|
+
[feedback]="false"
|
|
36
|
+
/>
|
|
37
|
+
<label for="user-password">Password</label>
|
|
38
|
+
</p-floatlabel>
|
|
39
|
+
</p-inputgroup>
|
|
40
|
+
|
|
41
|
+
@if (!passwordField.valid && passwordField.touched) {
|
|
42
|
+
<p-message class="rtsee-form-field-error-message"
|
|
43
|
+
severity="error"
|
|
44
|
+
variant="simple"
|
|
45
|
+
size="small"
|
|
46
|
+
>Password is required</p-message>
|
|
47
|
+
}
|
|
48
|
+
@if (serverSideError) {
|
|
49
|
+
<p-message class="rtsee-form-field-error-message"
|
|
50
|
+
severity="error"
|
|
51
|
+
variant="simple"
|
|
52
|
+
size="small"
|
|
53
|
+
>{{serverSideError}}</p-message>
|
|
54
|
+
}
|
|
55
|
+
</div>
|
|
56
|
+
<div class="rtsee-form-field-container">
|
|
57
|
+
<p-checkbox inputId="remember" [binary]="true" [formControl]="rememberField" />
|
|
58
|
+
<label for="remember" class="ml-2"> Remember me </label>
|
|
59
|
+
</div>
|
|
60
|
+
<div class="rtsee-form-field-container">
|
|
61
|
+
<a href="#"
|
|
62
|
+
[routerLink]="authConfiguration.getRoutePathSplit(AuthEndpointsKeys.FORGOT_PASSWORD)"
|
|
32
63
|
class="auth-deep-blue-sm-medium"
|
|
33
64
|
>Забули пароль?</a>
|
|
34
65
|
</div>
|
|
35
|
-
|
|
36
|
-
|
|
66
|
+
<div class="rtsee-form-submit-container">
|
|
67
|
+
<p-button type="submit"
|
|
68
|
+
label="Sign In"
|
|
69
|
+
[disabled]="loadInProgress"
|
|
70
|
+
/>
|
|
71
|
+
@if (loadInProgress) {
|
|
72
|
+
<p-progress-spinner class="rtsee-progress-spinner rtsee-progress-spinner-sm"></p-progress-spinner>
|
|
73
|
+
}
|
|
74
|
+
</div>
|
|
37
75
|
</form>
|
|
38
|
-
<p class="
|
|
76
|
+
<p class="rtsee-form-label">
|
|
39
77
|
<span>Немає акаунту?</span>
|
|
40
78
|
<span> </span>
|
|
41
79
|
<a href="#"
|
|
42
|
-
[routerLink]="
|
|
80
|
+
[routerLink]="authConfiguration.getRoutePathSplit(AuthEndpointsKeys.SIGN_UP)"
|
|
43
81
|
class="auth-deep-blue-sm-medium"
|
|
44
82
|
>Створіть!</a>
|
|
45
83
|
</p>
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { Component } from '@angular/core';
|
|
2
|
-
import {Router, RouterLink} from '@angular/router';
|
|
3
|
-
import {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
|
|
4
|
-
import { UtilsService } from '../services/utils.service';
|
|
2
|
+
import { Router, RouterLink } from '@angular/router';
|
|
3
|
+
import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
5
4
|
import { SignInForm, TypedReactiveForm } from '../types/auth-form.type';
|
|
6
|
-
import {NgOptimizedImage} from
|
|
5
|
+
import { NgOptimizedImage } from '@angular/common';
|
|
6
|
+
import { RTSeeAuthService } from '../services/auth.service';
|
|
7
|
+
import { AuthEndpointsKeys, RTSeeAuthConfiguration } from '@rtsee/auth';
|
|
8
|
+
import { ButtonModule } from 'primeng/button';
|
|
9
|
+
import { InputGroup } from 'primeng/inputgroup';
|
|
10
|
+
import { InputText } from 'primeng/inputtext';
|
|
11
|
+
import { Password } from 'primeng/password';
|
|
12
|
+
import { FloatLabel } from 'primeng/floatlabel';
|
|
13
|
+
import { Checkbox } from 'primeng/checkbox';
|
|
14
|
+
import { Message } from 'primeng/message';
|
|
15
|
+
import { ProgressSpinner } from 'primeng/progressspinner';
|
|
16
|
+
import {ServerSideError} from "../../../common/interfaces";
|
|
7
17
|
|
|
8
18
|
@Component({
|
|
9
19
|
selector: 'rtsee-sign-in',
|
|
@@ -11,34 +21,100 @@ import {NgOptimizedImage} from "@angular/common";
|
|
|
11
21
|
imports: [
|
|
12
22
|
NgOptimizedImage,
|
|
13
23
|
ReactiveFormsModule,
|
|
14
|
-
RouterLink
|
|
24
|
+
RouterLink,
|
|
25
|
+
ButtonModule,
|
|
26
|
+
InputGroup,
|
|
27
|
+
InputText,
|
|
28
|
+
Password,
|
|
29
|
+
FloatLabel,
|
|
30
|
+
Checkbox,
|
|
31
|
+
Message,
|
|
32
|
+
ProgressSpinner
|
|
15
33
|
],
|
|
16
34
|
standalone: true
|
|
17
35
|
})
|
|
18
36
|
export class SignInComponent {
|
|
19
|
-
public readonly signInForm: FormGroup<TypedReactiveForm<SignInForm>>
|
|
20
|
-
|
|
37
|
+
public readonly signInForm: FormGroup<TypedReactiveForm<SignInForm>> = this.formBuilder.group<TypedReactiveForm<SignInForm>>({
|
|
38
|
+
username: this.formBuilder.nonNullable.control({
|
|
39
|
+
value: '',
|
|
40
|
+
disabled: false
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
validators: [ Validators.required, Validators.email ]
|
|
44
|
+
}),
|
|
45
|
+
password: this.formBuilder.nonNullable.control({
|
|
46
|
+
value: '',
|
|
47
|
+
disabled: false
|
|
48
|
+
}, { validators: [ Validators.required ]}),
|
|
49
|
+
remember: this.formBuilder.nonNullable.control(false),
|
|
50
|
+
});
|
|
51
|
+
public readonly authConfiguration: RTSeeAuthConfiguration;
|
|
52
|
+
protected readonly AuthEndpointsKeys = AuthEndpointsKeys;
|
|
53
|
+
public loadInProgress: boolean = false;
|
|
54
|
+
public serverSideError: string = '';
|
|
21
55
|
|
|
22
56
|
constructor(
|
|
23
57
|
private readonly formBuilder: FormBuilder,
|
|
24
|
-
private readonly router: Router
|
|
58
|
+
private readonly router: Router,
|
|
59
|
+
public authService: RTSeeAuthService
|
|
25
60
|
) {
|
|
26
|
-
this.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
61
|
+
this.authConfiguration = this.authService.rtseeAuth.authConfiguration;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
get usernameField(): FormControl<string> {
|
|
65
|
+
return this.signInForm.get('username') as FormControl<string>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
get passwordField(): FormControl<string> {
|
|
69
|
+
return this.signInForm.get('password') as FormControl<string>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
get rememberField(): FormControl<boolean> {
|
|
73
|
+
return this.signInForm.get('remember') as FormControl<boolean>;
|
|
32
74
|
}
|
|
33
75
|
|
|
34
76
|
public login(): void {
|
|
35
77
|
if (this.signInForm.valid) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
78
|
+
this.disableFormFields();
|
|
79
|
+
this.authService.signIn(this.signInForm.getRawValue())
|
|
80
|
+
.subscribe({
|
|
81
|
+
next: (() => {
|
|
82
|
+
void this.router.navigate(this.authService.rtseeAuth.authConfiguration.defaultPostLoginRoute);
|
|
83
|
+
this.enableFormFields();
|
|
84
|
+
}),
|
|
85
|
+
error: ((error: ServerSideError) => {
|
|
86
|
+
console.log(error);
|
|
87
|
+
this.showServerSideErrorForXSeconds(error.error.message);
|
|
88
|
+
this.enableFormFields();
|
|
89
|
+
}),
|
|
90
|
+
complete: (() => {
|
|
91
|
+
this.enableFormFields();
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
this.signInForm.markAsTouched(); // this does not work after switching to "nonNullable" form fields
|
|
42
96
|
}
|
|
43
97
|
}
|
|
98
|
+
|
|
99
|
+
private showServerSideErrorForXSeconds(message: string, x: number = 3): void {
|
|
100
|
+
this.serverSideError = message;
|
|
101
|
+
|
|
102
|
+
setTimeout(() => {
|
|
103
|
+
this.serverSideError = '';
|
|
104
|
+
}, x * 1000); // we can do pop-up message instead
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
private disableFormFields(): void {
|
|
108
|
+
this.loadInProgress = true;
|
|
109
|
+
this.usernameField.disable();
|
|
110
|
+
this.passwordField.disable();
|
|
111
|
+
this.rememberField.disable();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private enableFormFields(): void {
|
|
115
|
+
this.loadInProgress = false;
|
|
116
|
+
this.usernameField.enable(); // fuck me, but [disabled]="loadInProgress" on the field no longer works :(
|
|
117
|
+
this.passwordField.enable();
|
|
118
|
+
this.rememberField.enable();
|
|
119
|
+
}
|
|
44
120
|
}
|
|
@@ -46,6 +46,6 @@
|
|
|
46
46
|
|
|
47
47
|
<!-- Redirect to Sign-In -->
|
|
48
48
|
<p class="auth-media-blue-gray-sm-normal">
|
|
49
|
-
Вже маєте акаунт? <a href="#" [routerLink]="
|
|
49
|
+
Вже маєте акаунт? <a href="#" [routerLink]="authConfiguration.getRoutePathSplit(AuthEndpointsKeys.SIGN_IN)" class="auth-deep-blue-sm-medium">Увійдіть</a>
|
|
50
50
|
</p>
|
|
51
51
|
</div>
|
|
@@ -5,6 +5,8 @@ import { UtilsService } from '../services/utils.service';
|
|
|
5
5
|
import {ConfirmPasswordValidator} from "../validators/form-fields-validators";
|
|
6
6
|
import {RouterLink} from "@angular/router";
|
|
7
7
|
import {NgOptimizedImage} from "@angular/common";
|
|
8
|
+
import {RTSeeAuthService} from "../services/auth.service";
|
|
9
|
+
import {RTSeeAuthConfiguration, AuthEndpointsKeys} from "@rtsee/auth";
|
|
8
10
|
|
|
9
11
|
@Component({
|
|
10
12
|
selector: 'rtsee-sign-up',
|
|
@@ -19,9 +21,11 @@ import {NgOptimizedImage} from "@angular/common";
|
|
|
19
21
|
export class SignUpComponent {
|
|
20
22
|
public readonly signUpForm: FormGroup<TypedReactiveForm<SignUpForm>>;
|
|
21
23
|
public readonly signUpFormKeys: Record<keyof SignUpForm, string>;
|
|
24
|
+
public readonly authConfiguration: RTSeeAuthConfiguration;
|
|
22
25
|
|
|
23
26
|
constructor(
|
|
24
|
-
private readonly formBuilder: FormBuilder
|
|
27
|
+
private readonly formBuilder: FormBuilder,
|
|
28
|
+
private authService: RTSeeAuthService
|
|
25
29
|
) {
|
|
26
30
|
this.signUpForm = this.formBuilder.group<TypedReactiveForm<SignUpForm>>({
|
|
27
31
|
email: this.formBuilder.control('', { validators: [Validators.required, Validators.email] }),
|
|
@@ -37,15 +41,27 @@ export class SignUpComponent {
|
|
|
37
41
|
}),
|
|
38
42
|
}, { validators: [ ConfirmPasswordValidator.MatchFields ] });
|
|
39
43
|
this.signUpFormKeys = UtilsService.getKeysAsValueObject(this.signUpForm.getRawValue());
|
|
44
|
+
this.authConfiguration = this.authService.rtseeAuth.authConfiguration;
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
public signUp(): void {
|
|
43
48
|
if (this.signUpForm.valid) {
|
|
44
|
-
const
|
|
49
|
+
const formValues: SignUpForm = this.signUpForm.getRawValue();
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
this.authService.signUp({
|
|
54
|
+
email: formValues.email!,
|
|
55
|
+
password: formValues.password!,
|
|
56
|
+
terms: formValues.terms!
|
|
57
|
+
})
|
|
58
|
+
|
|
45
59
|
|
|
46
60
|
|
|
47
61
|
// Call sign-up API
|
|
48
62
|
// this.authService.signUp(formValue);
|
|
49
63
|
}
|
|
50
64
|
}
|
|
65
|
+
|
|
66
|
+
protected readonly AuthEndpointsKeys = AuthEndpointsKeys;
|
|
51
67
|
}
|
|
@@ -26,11 +26,11 @@ export type ConfirmPasswordForm = {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export type ForgotPasswordForm = {
|
|
29
|
-
email: string
|
|
29
|
+
email: string;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export type SignInForm = {
|
|
33
|
-
username: string
|
|
34
|
-
password: string
|
|
33
|
+
username: string;
|
|
34
|
+
password: string;
|
|
35
35
|
remember: boolean;
|
|
36
36
|
};
|