@liquid-js/lyr-auth 0.0.0-stage → 22.0.0-alpha.0
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/LICENSE.txt +23 -0
- package/README.md +61 -2
- package/components/auth-block/_auth-block.component.theme.scss +17 -0
- package/components/auth-block/auth-block.component.scss +98 -0
- package/components/auth.component.html +22 -0
- package/components/auth.component.scss +54 -0
- package/components/login/login.component.html +154 -0
- package/components/logout/logout.component.html +1 -0
- package/components/register/register.component.html +212 -0
- package/components/register/register.component.scss +5 -0
- package/components/request-password/request-password.component.html +81 -0
- package/components/reset-password/reset-password.component.html +116 -0
- package/components/reset-password/reset-password.component.scss +5 -0
- package/fesm2022/liquid-js-lyr-auth.mjs +2900 -0
- package/fesm2022/liquid-js-lyr-auth.mjs.map +1 -0
- package/package.json +59 -3
- package/styles/_globals.scss +5 -0
- package/styles/global/_components.scss +6 -0
- package/styles/prebuilt/components-custom-properties.css +1 -0
- package/styles/prebuilt/components-custom-properties.scss +10 -0
- package/styles/prebuilt/corporate-custom-properties.css +1 -0
- package/styles/prebuilt/corporate-custom-properties.scss +2 -0
- package/styles/prebuilt/corporate.css +1 -0
- package/styles/prebuilt/corporate.scss +12 -0
- package/styles/prebuilt/cosmic-custom-properties.css +1 -0
- package/styles/prebuilt/cosmic-custom-properties.scss +2 -0
- package/styles/prebuilt/cosmic.css +1 -0
- package/styles/prebuilt/cosmic.scss +12 -0
- package/styles/prebuilt/dark-custom-properties.css +1 -0
- package/styles/prebuilt/dark-custom-properties.scss +2 -0
- package/styles/prebuilt/dark.css +1 -0
- package/styles/prebuilt/dark.scss +12 -0
- package/styles/prebuilt/default-custom-properties.css +1 -0
- package/styles/prebuilt/default-custom-properties.scss +2 -0
- package/styles/prebuilt/default.css +1 -0
- package/styles/prebuilt/default.scss +12 -0
- package/types/liquid-js-lyr-auth.d.ts +1236 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Akveo.
|
|
4
|
+
Copyright (c) 2026 Liquid-JS and contributors.
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
|
package/README.md
CHANGED
|
@@ -1,3 +1,62 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Lyra Auth
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/Liquid-JS/lyra/blob/master/LICENSE.txt)
|
|
4
|
+
[](https://www.npmjs.com/package/@liquid-js/lyr-auth)
|
|
5
|
+
[](https://www.npmjs.com/package/@liquid-js/lyr-auth)
|
|
6
|
+
|
|
7
|
+
Authentication for Angular: login, registration and password pages, strategies for passwords and OAuth2, tokens and
|
|
8
|
+
route guards.
|
|
9
|
+
|
|
10
|
+
## Quick links
|
|
11
|
+
|
|
12
|
+
- [Introduction](https://liquid-js.github.io/lyra/extras/auth/introduction/)
|
|
13
|
+
- [Installation](https://liquid-js.github.io/lyra/extras/auth/installation/)
|
|
14
|
+
- [Configuring a strategy](https://liquid-js.github.io/lyra/extras/auth/configuring-a-strategy/)
|
|
15
|
+
|
|
16
|
+
### Installing
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npm install --save @liquid-js/lyr-auth
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The built-in pages also need [Lyra](https://liquid-js.github.io/lyra/docs/guides/install-lyra/).
|
|
23
|
+
|
|
24
|
+
### Provide a strategy
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
|
28
|
+
import { NbPasswordAuthStrategy, provideNbAuth } from '@liquid-js/lyr-auth'
|
|
29
|
+
|
|
30
|
+
bootstrapApplication(AppComponent, {
|
|
31
|
+
providers: [
|
|
32
|
+
provideHttpClient(withInterceptorsFromDi()),
|
|
33
|
+
provideNbAuth({
|
|
34
|
+
strategies: [
|
|
35
|
+
NbPasswordAuthStrategy.setup({
|
|
36
|
+
name: 'email'
|
|
37
|
+
})
|
|
38
|
+
],
|
|
39
|
+
forms: {}
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
})
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Add the pages to the routes
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { NbAuthComponent, NbLoginComponent, NbLogoutComponent, NbRegisterComponent } from '@liquid-js/lyr-auth'
|
|
49
|
+
|
|
50
|
+
export const routes: Routes = [
|
|
51
|
+
{
|
|
52
|
+
path: 'auth',
|
|
53
|
+
component: NbAuthComponent,
|
|
54
|
+
children: [
|
|
55
|
+
{ path: '', component: NbLoginComponent },
|
|
56
|
+
{ path: 'login', component: NbLoginComponent },
|
|
57
|
+
{ path: 'register', component: NbRegisterComponent },
|
|
58
|
+
{ path: 'logout', component: NbLogoutComponent }
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@use "@liquid-js/lyr-core/styles/theming" as *;
|
|
2
|
+
|
|
3
|
+
@mixin nb-auth-block-theme() {
|
|
4
|
+
nb-auth-block {
|
|
5
|
+
.text-link {
|
|
6
|
+
color: nb-theme(text-hint-color);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.forgot-password {
|
|
10
|
+
color: nb-theme(text-disabled-color);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.socials a {
|
|
14
|
+
color: nb-theme(text-hint-color);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
width: 100%;
|
|
4
|
+
max-width: 35rem;
|
|
5
|
+
|
|
6
|
+
::ng-deep {
|
|
7
|
+
form {
|
|
8
|
+
width: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.label {
|
|
12
|
+
display: block;
|
|
13
|
+
margin-bottom: 0.5rem;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.forgot-password {
|
|
17
|
+
text-decoration: none;
|
|
18
|
+
margin-bottom: 0.5rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.caption {
|
|
22
|
+
margin-top: 0.5rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.alert {
|
|
26
|
+
text-align: center;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.title {
|
|
30
|
+
margin-top: 0;
|
|
31
|
+
margin-bottom: 0.75rem;
|
|
32
|
+
text-align: center;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.sub-title {
|
|
36
|
+
margin-bottom: 2rem;
|
|
37
|
+
text-align: center;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.form-control-group {
|
|
41
|
+
margin-bottom: 2rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.form-control-group.accept-group {
|
|
45
|
+
display: flex;
|
|
46
|
+
justify-content: space-between;
|
|
47
|
+
margin: 2rem 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.label-with-link {
|
|
51
|
+
display: flex;
|
|
52
|
+
justify-content: space-between;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.links {
|
|
56
|
+
text-align: center;
|
|
57
|
+
margin-top: 1.75rem;
|
|
58
|
+
|
|
59
|
+
.socials {
|
|
60
|
+
margin-top: 1.5rem;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.socials a {
|
|
64
|
+
margin: 0 1rem;
|
|
65
|
+
text-decoration: none;
|
|
66
|
+
vertical-align: middle;
|
|
67
|
+
|
|
68
|
+
&.with-icon {
|
|
69
|
+
font-size: 2rem;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.another-action {
|
|
75
|
+
margin-top: 2rem;
|
|
76
|
+
text-align: center;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.sign-in-or-up {
|
|
80
|
+
margin-top: 2rem;
|
|
81
|
+
display: flex;
|
|
82
|
+
justify-content: space-between;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
nb-alert {
|
|
86
|
+
.alert-title,
|
|
87
|
+
.alert-message {
|
|
88
|
+
margin: 0 0 0.5rem;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.alert-message-list {
|
|
92
|
+
list-style-type: none;
|
|
93
|
+
padding: 0;
|
|
94
|
+
margin: 0;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<nb-layout>
|
|
2
|
+
<nb-layout-column>
|
|
3
|
+
<nb-card>
|
|
4
|
+
<nb-card-header>
|
|
5
|
+
<nav class="navigation">
|
|
6
|
+
<a href="#"
|
|
7
|
+
(click)="back()"
|
|
8
|
+
class="link back-link"
|
|
9
|
+
[attr.aria-label]="texts().back">
|
|
10
|
+
<nb-icon icon="arrow-back-outline"
|
|
11
|
+
pack="essentials" />
|
|
12
|
+
</a>
|
|
13
|
+
</nav>
|
|
14
|
+
</nb-card-header>
|
|
15
|
+
<nb-card-body>
|
|
16
|
+
<nb-auth-block>
|
|
17
|
+
<router-outlet />
|
|
18
|
+
</nb-auth-block>
|
|
19
|
+
</nb-card-body>
|
|
20
|
+
</nb-card>
|
|
21
|
+
</nb-layout-column>
|
|
22
|
+
</nb-layout>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@use "@liquid-js/lyr-core/styles/globals" as *;
|
|
2
|
+
@use "@liquid-js/lyr-core/styles/theming" as *;
|
|
3
|
+
|
|
4
|
+
:host {
|
|
5
|
+
$auth-layout-padding: 2.5rem;
|
|
6
|
+
|
|
7
|
+
nb-card {
|
|
8
|
+
margin: 0;
|
|
9
|
+
height: calc(100dvh - 2 * #{$auth-layout-padding});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.navigation .link {
|
|
13
|
+
display: inline-block;
|
|
14
|
+
text-decoration: none;
|
|
15
|
+
|
|
16
|
+
nb-icon {
|
|
17
|
+
font-size: 2rem;
|
|
18
|
+
vertical-align: middle;
|
|
19
|
+
|
|
20
|
+
// The arrow points back, to the start.
|
|
21
|
+
@include nb-rtl(transform, scaleX(-1));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.links nb-icon {
|
|
26
|
+
font-size: 2.5rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
nb-card-body {
|
|
30
|
+
display: flex;
|
|
31
|
+
width: 100%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
nb-auth-block {
|
|
35
|
+
margin: auto;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@include media-breakpoint-down(sm) {
|
|
39
|
+
nb-card {
|
|
40
|
+
border-radius: 0;
|
|
41
|
+
height: 100dvh;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
::ng-deep {
|
|
46
|
+
nb-layout .layout .layout-container .content .columns nb-layout-column {
|
|
47
|
+
padding: $auth-layout-padding;
|
|
48
|
+
|
|
49
|
+
@include media-breakpoint-down(sm) {
|
|
50
|
+
padding: 0;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<h1 id="title"
|
|
2
|
+
class="title">{{ texts().loginTitle }}</h1>
|
|
3
|
+
<p class="sub-title">{{ texts().loginSubtitle }}</p>
|
|
4
|
+
|
|
5
|
+
@if (showMessages.error && errors?.length && !submitted) {
|
|
6
|
+
<nb-alert status="danger"
|
|
7
|
+
outline
|
|
8
|
+
role="alert">
|
|
9
|
+
<p class="alert-title"><b>{{ texts().errorTitle }}</b></p>
|
|
10
|
+
<ul class="alert-message-list">
|
|
11
|
+
@for (error of errors; track $index) {
|
|
12
|
+
<li class="alert-message">{{ error }}</li>
|
|
13
|
+
}
|
|
14
|
+
</ul>
|
|
15
|
+
</nb-alert>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@if (showMessages.success && messages?.length && !submitted) {
|
|
19
|
+
<nb-alert status="success"
|
|
20
|
+
outline
|
|
21
|
+
role="alert">
|
|
22
|
+
<p class="alert-title"><b>{{ texts().successTitle }}</b></p>
|
|
23
|
+
<ul class="alert-message-list">
|
|
24
|
+
@for (message of messages; track $index) {
|
|
25
|
+
<li class="alert-message">{{ message }}</li>
|
|
26
|
+
}
|
|
27
|
+
</ul>
|
|
28
|
+
</nb-alert>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
<form (ngSubmit)="login()"
|
|
32
|
+
#form="ngForm"
|
|
33
|
+
aria-labelledby="title">
|
|
34
|
+
|
|
35
|
+
<div class="form-control-group">
|
|
36
|
+
<label class="label"
|
|
37
|
+
for="input-email">{{ texts().emailLabel }}</label>
|
|
38
|
+
<input nbInput
|
|
39
|
+
fullWidth
|
|
40
|
+
[(ngModel)]="user.email"
|
|
41
|
+
#email="ngModel"
|
|
42
|
+
name="email"
|
|
43
|
+
id="input-email"
|
|
44
|
+
pattern=".+@.+\..+"
|
|
45
|
+
[placeholder]="texts().emailPlaceholder"
|
|
46
|
+
fieldSize="large"
|
|
47
|
+
autofocus
|
|
48
|
+
[status]="email.dirty ? (email.invalid ? 'danger' : 'success') : 'basic'"
|
|
49
|
+
[required]="getConfigValue('forms.validation.email.required')"
|
|
50
|
+
[attr.aria-invalid]="email.invalid && email.touched ? true : null">
|
|
51
|
+
@if (email.invalid && email.touched) {
|
|
52
|
+
@if (email.errors?.['required']) {
|
|
53
|
+
<p class="caption status-danger">
|
|
54
|
+
{{ texts().emailRequired }}
|
|
55
|
+
</p>
|
|
56
|
+
}
|
|
57
|
+
@if (email.errors?.['pattern']) {
|
|
58
|
+
<p class="caption status-danger">
|
|
59
|
+
{{ texts().emailInvalid }}
|
|
60
|
+
</p>
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div class="form-control-group">
|
|
66
|
+
<span class="label-with-link">
|
|
67
|
+
<label class="label"
|
|
68
|
+
for="input-password">{{ texts().passwordLabel }}</label>
|
|
69
|
+
<a class="forgot-password caption-2"
|
|
70
|
+
routerLink="../request-password">{{ texts().forgotPassword }}</a>
|
|
71
|
+
</span>
|
|
72
|
+
<input nbInput
|
|
73
|
+
fullWidth
|
|
74
|
+
[(ngModel)]="user.password"
|
|
75
|
+
#password="ngModel"
|
|
76
|
+
name="password"
|
|
77
|
+
type="password"
|
|
78
|
+
id="input-password"
|
|
79
|
+
[placeholder]="texts().passwordPlaceholder"
|
|
80
|
+
fieldSize="large"
|
|
81
|
+
[status]="password.dirty ? (password.invalid ? 'danger' : 'success') : 'basic'"
|
|
82
|
+
[required]="getConfigValue('forms.validation.password.required')"
|
|
83
|
+
[minlength]="getConfigValue('forms.validation.password.minLength')"
|
|
84
|
+
[maxlength]="getConfigValue('forms.validation.password.maxLength')"
|
|
85
|
+
[attr.aria-invalid]="password.invalid && password.touched ? true : null">
|
|
86
|
+
@if (password.invalid && password.touched ) {
|
|
87
|
+
@if (password.errors?.['required']) {
|
|
88
|
+
<p class="caption status-danger">
|
|
89
|
+
{{ texts().passwordRequired }}
|
|
90
|
+
</p>
|
|
91
|
+
}
|
|
92
|
+
@if (password.errors?.['minlength'] || password.errors?.['maxlength']) {
|
|
93
|
+
<p class="caption status-danger">
|
|
94
|
+
{{ texts().passwordLength(getConfigValue('forms.validation.password.minLength'), getConfigValue('forms.validation.password.maxLength')) }}
|
|
95
|
+
</p>
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<div class="form-control-group accept-group">
|
|
101
|
+
@if (rememberMe) {
|
|
102
|
+
<nb-checkbox name="rememberMe"
|
|
103
|
+
[(ngModel)]="user.rememberMe">{{ texts().rememberMe }}</nb-checkbox>
|
|
104
|
+
}
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<button nbButton
|
|
108
|
+
fullWidth
|
|
109
|
+
status="primary"
|
|
110
|
+
size="large"
|
|
111
|
+
[disabled]="submitted || !form.valid"
|
|
112
|
+
[class.btn-pulse]="submitted">
|
|
113
|
+
{{ texts().loginSubmit }}
|
|
114
|
+
</button>
|
|
115
|
+
</form>
|
|
116
|
+
|
|
117
|
+
@if (socialLinks && socialLinks.length > 0) {
|
|
118
|
+
<section class="links"
|
|
119
|
+
[attr.aria-label]="texts().socialLabel">
|
|
120
|
+
{{ texts().socialPrompt }}
|
|
121
|
+
<div class="socials">
|
|
122
|
+
@for (socialLink of socialLinks; track socialLink) {
|
|
123
|
+
@if (socialLink.link) {
|
|
124
|
+
<a [routerLink]="socialLink.link"
|
|
125
|
+
[attr.target]="socialLink.target"
|
|
126
|
+
[attr.class]="socialLink.icon"
|
|
127
|
+
[attr.aria-label]="socialLink.icon ? socialLink.title : null"
|
|
128
|
+
[class.with-icon]="socialLink.icon">
|
|
129
|
+
@if (socialLink.icon) {
|
|
130
|
+
<nb-icon [icon]="socialLink.icon" />
|
|
131
|
+
} @else {{{ socialLink.title }}}
|
|
132
|
+
</a>
|
|
133
|
+
}
|
|
134
|
+
@if (socialLink.url) {
|
|
135
|
+
<a [attr.href]="socialLink.url"
|
|
136
|
+
[attr.target]="socialLink.target"
|
|
137
|
+
[attr.class]="socialLink.icon"
|
|
138
|
+
[attr.aria-label]="socialLink.icon ? socialLink.title : null"
|
|
139
|
+
[class.with-icon]="socialLink.icon">
|
|
140
|
+
@if (socialLink.icon) {
|
|
141
|
+
<nb-icon [icon]="socialLink.icon" />
|
|
142
|
+
} @else {{{ socialLink.title }}}
|
|
143
|
+
</a>
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
</div>
|
|
147
|
+
</section>
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
<section class="another-action"
|
|
151
|
+
[attr.aria-label]="texts().registerLink">
|
|
152
|
+
{{ texts().noAccount }} <a class="text-link"
|
|
153
|
+
routerLink="../register">{{ texts().registerLink }}</a>
|
|
154
|
+
</section>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div>{{ texts().loggingOut }}</div>
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<h1 id="title"
|
|
2
|
+
class="title">{{ texts().registerTitle }}</h1>
|
|
3
|
+
|
|
4
|
+
@if (showMessages.error && errors?.length && !submitted) {
|
|
5
|
+
<nb-alert status="danger"
|
|
6
|
+
outline
|
|
7
|
+
role="alert">
|
|
8
|
+
<p class="alert-title"><b>{{ texts().errorTitle }}</b></p>
|
|
9
|
+
<ul class="alert-message-list">
|
|
10
|
+
@for (error of errors; track $index) {
|
|
11
|
+
<li class="alert-message">{{ error }}</li>
|
|
12
|
+
}
|
|
13
|
+
</ul>
|
|
14
|
+
</nb-alert>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@if (showMessages.success && messages?.length && !submitted) {
|
|
18
|
+
<nb-alert status="success"
|
|
19
|
+
outline
|
|
20
|
+
role="alert">
|
|
21
|
+
<p class="alert-title"><b>{{ texts().successTitle }}</b></p>
|
|
22
|
+
<ul class="alert-message-list">
|
|
23
|
+
@for (message of messages; track $index) {
|
|
24
|
+
<li class="alert-message">{{ message }}</li>
|
|
25
|
+
}
|
|
26
|
+
</ul>
|
|
27
|
+
</nb-alert>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
<form (ngSubmit)="register()"
|
|
31
|
+
#form="ngForm"
|
|
32
|
+
aria-labelledby="title">
|
|
33
|
+
|
|
34
|
+
<div class="form-control-group">
|
|
35
|
+
<label class="label"
|
|
36
|
+
for="input-name">{{ texts().fullNameLabel }}</label>
|
|
37
|
+
<input nbInput
|
|
38
|
+
[(ngModel)]="user.fullName"
|
|
39
|
+
#fullName="ngModel"
|
|
40
|
+
id="input-name"
|
|
41
|
+
name="fullName"
|
|
42
|
+
[placeholder]="texts().fullNamePlaceholder"
|
|
43
|
+
autofocus
|
|
44
|
+
fullWidth
|
|
45
|
+
fieldSize="large"
|
|
46
|
+
[status]="fullName.dirty ? (fullName.invalid ? 'danger' : 'success') : 'basic'"
|
|
47
|
+
[required]="getConfigValue('forms.validation.fullName.required')"
|
|
48
|
+
[minlength]="getConfigValue('forms.validation.fullName.minLength')"
|
|
49
|
+
[maxlength]="getConfigValue('forms.validation.fullName.maxLength')"
|
|
50
|
+
[attr.aria-invalid]="fullName.invalid && fullName.touched ? true : null">
|
|
51
|
+
@if (fullName.invalid && fullName.touched) {
|
|
52
|
+
@if (fullName.errors?.['required']) {
|
|
53
|
+
<p class="caption status-danger">
|
|
54
|
+
{{ texts().fullNameRequired }}
|
|
55
|
+
</p>
|
|
56
|
+
}
|
|
57
|
+
@if (fullName.errors?.['minlength'] || fullName.errors?.['maxlength']) {
|
|
58
|
+
<p class="caption status-danger">
|
|
59
|
+
{{ texts().fullNameLength(getConfigValue('forms.validation.fullName.minLength'), getConfigValue('forms.validation.fullName.maxLength')) }}
|
|
60
|
+
</p>
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div class="form-control-group">
|
|
66
|
+
<label class="label"
|
|
67
|
+
for="input-email">{{ texts().emailLabel }}</label>
|
|
68
|
+
<input nbInput
|
|
69
|
+
[(ngModel)]="user.email"
|
|
70
|
+
#email="ngModel"
|
|
71
|
+
id="input-email"
|
|
72
|
+
name="email"
|
|
73
|
+
pattern=".+@.+\..+"
|
|
74
|
+
[placeholder]="texts().emailPlaceholder"
|
|
75
|
+
fullWidth
|
|
76
|
+
fieldSize="large"
|
|
77
|
+
[status]="email.dirty ? (email.invalid ? 'danger' : 'success') : 'basic'"
|
|
78
|
+
[required]="getConfigValue('forms.validation.email.required')"
|
|
79
|
+
[attr.aria-invalid]="email.invalid && email.touched ? true : null">
|
|
80
|
+
@if (email.invalid && email.touched) {
|
|
81
|
+
@if (email.errors?.['required']) {
|
|
82
|
+
<p class="caption status-danger">
|
|
83
|
+
{{ texts().emailRequired }}
|
|
84
|
+
</p>
|
|
85
|
+
}
|
|
86
|
+
@if (email.errors?.['pattern']) {
|
|
87
|
+
<p class="caption status-danger">
|
|
88
|
+
{{ texts().emailInvalid }}
|
|
89
|
+
</p>
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<div class="form-control-group">
|
|
95
|
+
<label class="label"
|
|
96
|
+
for="input-password">{{ texts().passwordLabel }}</label>
|
|
97
|
+
<input nbInput
|
|
98
|
+
[(ngModel)]="user.password"
|
|
99
|
+
#password="ngModel"
|
|
100
|
+
type="password"
|
|
101
|
+
id="input-password"
|
|
102
|
+
name="password"
|
|
103
|
+
[placeholder]="texts().passwordPlaceholder"
|
|
104
|
+
fullWidth
|
|
105
|
+
fieldSize="large"
|
|
106
|
+
[status]="password.dirty ? (password.invalid ? 'danger' : 'success') : 'basic'"
|
|
107
|
+
[required]="getConfigValue('forms.validation.password.required')"
|
|
108
|
+
[minlength]="getConfigValue('forms.validation.password.minLength')"
|
|
109
|
+
[maxlength]="getConfigValue('forms.validation.password.maxLength')"
|
|
110
|
+
[attr.aria-invalid]="password.invalid && password.touched ? true : null">
|
|
111
|
+
@if (password.invalid && password.touched) {
|
|
112
|
+
@if (password.errors?.['required']) {
|
|
113
|
+
<p class="caption status-danger">
|
|
114
|
+
{{ texts().passwordRequired }}
|
|
115
|
+
</p>
|
|
116
|
+
}
|
|
117
|
+
@if (password.errors?.['minlength'] || password.errors?.['maxlength']) {
|
|
118
|
+
<p class="caption status-danger">
|
|
119
|
+
{{ texts().passwordLength(getConfigValue('forms.validation.password.minLength'), getConfigValue('forms.validation.password.maxLength')) }}
|
|
120
|
+
</p>
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
<div class="form-control-group">
|
|
126
|
+
<label class="label"
|
|
127
|
+
for="input-re-password">{{ texts().repeatPasswordLabel }}</label>
|
|
128
|
+
<input nbInput
|
|
129
|
+
[(ngModel)]="user.confirmPassword"
|
|
130
|
+
#rePass="ngModel"
|
|
131
|
+
type="password"
|
|
132
|
+
id="input-re-password"
|
|
133
|
+
name="rePass"
|
|
134
|
+
[placeholder]="texts().confirmPasswordPlaceholder"
|
|
135
|
+
fullWidth
|
|
136
|
+
fieldSize="large"
|
|
137
|
+
[status]="rePass.dirty ? (rePass.invalid || password.value !== rePass.value ? 'danger' : 'success') : 'basic'"
|
|
138
|
+
[required]="getConfigValue('forms.validation.password.required')"
|
|
139
|
+
[attr.aria-invalid]="(rePass.invalid || password.value !== rePass.value) && rePass.touched ? true : null">
|
|
140
|
+
@if ((rePass.invalid || password.value !== rePass.value) && rePass.touched) {
|
|
141
|
+
@if (rePass.errors?.['required']) {
|
|
142
|
+
<p class="caption status-danger">
|
|
143
|
+
{{ texts().confirmPasswordRequired }}
|
|
144
|
+
</p>
|
|
145
|
+
}
|
|
146
|
+
@if (password.value !== rePass.value && !rePass.errors?.['required']) {
|
|
147
|
+
<p class="caption status-danger">
|
|
148
|
+
{{ texts().passwordMismatch }}
|
|
149
|
+
</p>
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
@if (getConfigValue('forms.register.terms')) {
|
|
155
|
+
<div class="form-control-group accept-group">
|
|
156
|
+
<nb-checkbox name="terms"
|
|
157
|
+
[(ngModel)]="user.terms"
|
|
158
|
+
[required]="getConfigValue('forms.register.terms')">
|
|
159
|
+
{{ texts().agreeTo }} <a href="#"
|
|
160
|
+
target="_blank"><strong>{{ texts().terms }}</strong></a>
|
|
161
|
+
</nb-checkbox>
|
|
162
|
+
</div>
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
<button nbButton
|
|
166
|
+
fullWidth
|
|
167
|
+
status="primary"
|
|
168
|
+
size="large"
|
|
169
|
+
[disabled]="submitted || !form.valid || user.password !== user.confirmPassword"
|
|
170
|
+
[class.btn-pulse]="submitted">
|
|
171
|
+
{{ texts().registerSubmit }}
|
|
172
|
+
</button>
|
|
173
|
+
</form>
|
|
174
|
+
|
|
175
|
+
@if (socialLinks && socialLinks.length > 0) {
|
|
176
|
+
<section class="links"
|
|
177
|
+
[attr.aria-label]="texts().socialLabel">
|
|
178
|
+
{{ texts().socialPrompt }}
|
|
179
|
+
<div class="socials">
|
|
180
|
+
@for (socialLink of socialLinks; track socialLink) {
|
|
181
|
+
@if (socialLink.link) {
|
|
182
|
+
<a [routerLink]="socialLink.link"
|
|
183
|
+
[attr.target]="socialLink.target"
|
|
184
|
+
[attr.class]="socialLink.icon"
|
|
185
|
+
[attr.aria-label]="socialLink.icon ? socialLink.title : null"
|
|
186
|
+
[class.with-icon]="socialLink.icon">
|
|
187
|
+
@if (socialLink.icon) {
|
|
188
|
+
<nb-icon [icon]="socialLink.icon" />
|
|
189
|
+
} @else {{{ socialLink.title }}}
|
|
190
|
+
</a>
|
|
191
|
+
}
|
|
192
|
+
@if (socialLink.url) {
|
|
193
|
+
<a [attr.href]="socialLink.url"
|
|
194
|
+
[attr.target]="socialLink.target"
|
|
195
|
+
[attr.class]="socialLink.icon"
|
|
196
|
+
[attr.aria-label]="socialLink.icon ? socialLink.title : null"
|
|
197
|
+
[class.with-icon]="socialLink.icon">
|
|
198
|
+
@if (socialLink.icon) {
|
|
199
|
+
<nb-icon [icon]="socialLink.icon" />
|
|
200
|
+
} @else {{{ socialLink.title }}}
|
|
201
|
+
</a>
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
</div>
|
|
205
|
+
</section>
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
<section class="another-action"
|
|
209
|
+
[attr.aria-label]="texts().signInLabel">
|
|
210
|
+
{{ texts().haveAccount }} <a class="text-link"
|
|
211
|
+
routerLink="../login">{{ texts().loginLink }}</a>
|
|
212
|
+
</section>
|