Register Success component

This commit is contained in:
Michał Romaszkin 2020-11-08 20:17:28 +01:00
parent b70ba367ff
commit f9cb1d73da
8 changed files with 43 additions and 47 deletions

View File

@ -33,7 +33,7 @@
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.1002.0",
"@angular/cli": "~10.0.0",
"@angular/cli": "~10.2.0",
"@angular/compiler-cli": "~10.0.0",
"@angular/language-service": "~10.0.0",
"@schematics/angular": "~9.1.0",

View File

@ -45,20 +45,25 @@ import { EffectsModule } from '@ngrx/effects';
strategies: [
NbPasswordAuthStrategy.setup({
name: 'email',
baseEndpoint: 'http://127.0.0.1:8000',
login: {
redirect: {
success: '/view/',
success: '/view',
failure: null,
},
defaultErrors: ['Coś poszło nie tak, proszę spróbować ponownie.'],
},
token: {
class: NbAuthJWTToken,
},
register: {
endpoint: '/user',
method: 'post',
redirect: {
success: '/my-account/',
success: '/register-success',
failure: null,
},
defaultErrors: ['Coś poszło nie tak, proszę spróbować ponownie.'],
},
}),
],

View File

@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { NbAuthComponent } from '@nebular/auth';
import { LoginComponent } from './login/login.component';
import { RegisterSuccessComponent } from './register-success/register-success.component';
import { RegisterComponent } from './register/register.component';
export const routes: Routes = [
@ -15,8 +16,12 @@ export const routes: Routes = [
},
{
path: 'register',
component: RegisterComponent
}
component: RegisterComponent,
},
{
path: 'register-success',
component: RegisterSuccessComponent,
},
],
},
];

View File

@ -13,6 +13,7 @@ import {
} from '@nebular/theme';
import { LoginComponent } from './login/login.component';
import { RegisterComponent } from './register/register.component';
import { RegisterSuccessComponent } from './register-success/register-success.component';
@NgModule({
imports: [
@ -26,6 +27,6 @@ import { RegisterComponent } from './register/register.component';
AuthRoutingModule,
NbAuthModule,
],
declarations: [LoginComponent, RegisterComponent],
declarations: [LoginComponent, RegisterComponent, RegisterSuccessComponent],
})
export class AuthModule {}

View File

@ -0,0 +1,9 @@
<h1 id="title" class="title">Gratulacje!</h1>
<p class="sub-title">
Udało się utworzyć konto o podanym adresie e-mail. Naciśnij przycisk, aby
kontynuować
</p>
<button nbButton fullWidth status="success" routerLink="../login">
Zaloguj się
</button>

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'register-success',
templateUrl: './register-success.component.html',
styleUrls: ['./register-success.component.scss']
})
export class RegisterSuccessComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

View File

@ -25,44 +25,6 @@
</nb-alert>
<form (ngSubmit)="register()" #form="ngForm" aria-labelledby="title">
<div class="form-control-group">
<label class="label" for="input-name">Imię i nazwisko</label>
<input
nbInput
[(ngModel)]="user.fullName"
#fullName="ngModel"
id="input-name"
name="fullName"
placeholder="Full name"
autofocus
fullWidth
[status]="email.dirty ? (email.invalid ? 'danger' : 'success') : 'basic'"
[required]="getConfigValue('forms.validation.fullName.required')"
[minlength]="getConfigValue('forms.validation.fullName.minLength')"
[maxlength]="getConfigValue('forms.validation.fullName.maxLength')"
[attr.aria-invalid]="fullName.invalid && fullName.touched ? true : null"
/>
<ng-container *ngIf="fullName.invalid && fullName.touched">
<nb-alert
status="danger"
class="custom-size-error"
*ngIf="fullName.errors?.required"
>
Imię i nazwisko jest wymagane!
</nb-alert>
<nb-alert
status="danger"
class="custom-size-error"
*ngIf="fullName.errors?.minlength || fullName.errors?.maxlength"
>
Dane powinny zawierać od
{{ getConfigValue("forms.validation.fullName.minLength") }} do
{{ getConfigValue("forms.validation.fullName.maxLength") }}
znaków
</nb-alert>
</ng-container>
</div>
<div class="form-control-group">
<label class="label" for="input-email">Adres e-mail:</label>
<input
@ -123,7 +85,7 @@
</nb-alert>
<nb-alert
status="danger"
class="error-message"
class="custom-size-error"
*ngIf="password.errors?.minlength || password.errors?.maxlength"
>
Hasło powinno zawierać od
@ -135,7 +97,7 @@
</div>
<div class="form-control-group">
<label class="label" for="input-re-password">Repeat password:</label>
<label class="label" for="input-re-password">Powtórz hasło:</label>
<input
nbInput
[(ngModel)]="user.confirmPassword"
@ -143,7 +105,6 @@
type="password"
id="input-re-password"
name="rePass"
placeholder="Confirm Password"
fullWidth
[status]="
email.dirty