modal logi

master
Boris Voropaev 2023-12-12 10:35:31 +03:00
parent b84c331917
commit 6f52baf643
15 changed files with 162 additions and 175 deletions

View File

@ -1,7 +1,9 @@
<modal (close)="close()">
<div [ngSwitch]="url"header>
<h3 *ngSwitchCase="'login'">Вход в систему</h3>
<h3 *ngSwitchCase="'signup'">Регистрация</h3>
<h3 *ngSwitchCase="'password/forget'">Восстановление пароля</h3>
<h3 *ngSwitchCase="'password/reset'">Сброс пароля</h3>
</div>
<div class="authentication">

View File

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AuthModalComponent } from './auth-modal.component';
describe('AuthModalComponent', () => {
let component: AuthModalComponent;
let fixture: ComponentFixture<AuthModalComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AuthModalComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(AuthModalComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -19,7 +19,6 @@ export class AuthModalComponent {
}
close() {
console.log('CLS')
this.router.navigate([{outlets: {auth: null}}]).then();
}
}

View File

@ -17,8 +17,10 @@ const routes = [
{path: 'login', component: AuthModalComponent, canActivate: [NotAuthGuard], outlet: 'auth'},
{path: 'signup', component: AuthPageComponent, canActivate: [NotAuthGuard]},
{path: 'signup', component: AuthModalComponent, canActivate: [NotAuthGuard], outlet: 'auth'},
{path: 'password/forget', component: AuthPageComponent, canActivate: [NotAuthGuard]},
{path: 'password/forget', component: AuthModalComponent, canActivate: [NotAuthGuard], outlet: 'auth'},
{path: 'password/reset/:token/:email', component: AuthPageComponent, canActivate: [NotAuthGuard]}
{path: 'password/reset/:token/:email', component: AuthPageComponent, canActivate: [NotAuthGuard]},
{path: 'password/reset/:token/:email', component: AuthPageComponent, canActivate: [NotAuthGuard], outlet: 'auth'}
];
@NgModule({

View File

@ -7,7 +7,7 @@ import {AuthenticationService} from '@app/_services';
@Component({
selector: 'auth-form-password-forget',
templateUrl: 'auth-form-password-forget.component.html',
styleUrls: ['auth-form-password-forget.component.scss', '../forms.component.scss']
styleUrls: ['auth-form-password-forget.component.scss']
})
export class AuthFormPasswordForgetComponent implements OnInit {
form: FormGroup;

View File

@ -1,88 +0,0 @@
h2 {
margin: 0 0 24px;
font-size: 24px;
font-weight: normal;
}
.field {
margin: 0 0 16px;
label {
font-size: 14px;
color: #666666;
line-height: 20px;
}
.checkbox {
display: flex;
flex-direction: row;
gap: 12px;
margin: 0 0 12px;
&:last-child {margin: 0;}
label {
font-size: 0.875rem;
color: #86898E;
a {
color: #F9B417;
}
}
input {
flex-shrink: 0;
width: 20px;
height: 20px;
margin: 0;
padding: 0;
}
}
}
.error {
margin: 0 0 16px;
font-size: 14px;
color: #D91519;
text-align: center;
}
.bar {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
flex-wrap: wrap;
row-gap: 18px;
.remember {
display: flex;
flex-direction: row;
align-items: center;
input {
width: 16px;
height: 16px;
margin-right: 8px;
border-radius: 2px;
border: 1px solid #86898E;
}
}
.forget {
margin-left: auto;
cursor: pointer;
}
}
.bottom {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
gap: 24px;
margin: 24px 0 0;
}
@media screen and (max-width: 600px) {
.bottom {
flex-direction: column-reverse;
button {
width: 100%;
}
}
}

View File

@ -1,5 +1,4 @@
<form [formGroup]="form" (submit)="onSubmit()">
<form [formGroup]="form" (submit)="onSubmit()">
<div class="field" [class.invalid]="username.invalid && username.touched">
<label for="username">Логин</label>
<input id="username" formControlName="username" type="email" />
@ -14,8 +13,10 @@
<input id="remember" type="checkbox" />
<label for="remember">Запомнить меня</label>
</div>
<a class="forget" (click)="forget()">Забыли пароль?</a>
<a class="forget" (click)="signup()">Регистрация</a>
<div class="forget">
<a (click)="forget()">Забыли пароль?</a>
<a (click)="signup()">Регистрация</a>
</div>
</div>
<div class="bottom">
<button [disabled]="loading" type="submit" class="btn">Войти</button>

View File

@ -6,7 +6,7 @@ import {AuthenticationService} from '@app/_services';
@Component({
selector: 'auth-form-login',
templateUrl: 'auth-form-login.component.html',
styleUrls: ['auth-form-login.component.scss', '../forms.component.scss']
styleUrls: ['auth-form-login.component.scss']
})
export class AuthFormLoginComponent implements OnInit {
form: FormGroup;

View File

@ -1,5 +1,4 @@
<form [formGroup]="form" (submit)="onSubmit()">
<h2>Сброс пароля</h2>
<div class="field password">
<label for="password">Укажите новый пароль</label>
<input id="password" formControlName="password" type="password" />

View File

@ -7,7 +7,7 @@ import {AuthenticationService} from '@app/_services';
@Component({
selector: 'auth-form-password-reset',
templateUrl: 'auth-form-password-reset.component.html',
styleUrls: ['auth-form-password-reset.component.scss', '../forms.component.scss']
styleUrls: ['auth-form-password-reset.component.scss']
})
export class AuthFormPasswordResetComponent implements OnInit {
form: FormGroup;

View File

@ -1,5 +1,4 @@
<form [formGroup]="form" (submit)="onSubmit()">
<h2>Регистрация</h2>
<div class="body">
<div class="field" [class.invalid]="email.invalid && email.touched">
<label for="email">Электронная почта*</label>

View File

@ -8,7 +8,7 @@ import {Subscription} from "rxjs";
@Component({
selector: 'auth-form-signup',
templateUrl: 'auth-form-signup.component.html',
styleUrls: ['auth-form-signup.component.scss', '../forms.component.scss']
styleUrls: ['auth-form-signup.component.scss']
})
export class AuthFormSignupComponent implements OnInit {
form: FormGroup;

View File

@ -1,12 +1,12 @@
<div class="authentication">
<div class="logo">
<div class="center">
<img src="assets/images/logo.svg" /><br />
<p>Реестр средств измерений</p>
</div>
</div>
<div class="form">
<div class="center" [ngSwitch]="url">
<div [ngSwitch]="url"header>
<h3 *ngSwitchCase="'login'">Вход в систему</h3>
<h3 *ngSwitchCase="'signup'">Регистрация</h3>
<h3 *ngSwitchCase="'password/forget'">Восстановление пароля</h3>
<h3 *ngSwitchCase="'password/reset'">Сброс пароля</h3>
</div>
<auth-form-login *ngSwitchCase="'login'"></auth-form-login>
<auth-form-signup *ngSwitchCase="'signup'"></auth-form-signup>
<auth-form-password-forget *ngSwitchCase="'password/forget'"></auth-form-password-forget>

View File

@ -1,46 +0,0 @@
.authentication {
display: flex;
flex-direction: row;
width: 100%;
height: 100vh;
.logo {
display: flex;
width: 50%;
flex-shrink: 0;
height: 100%;
border-right: #E0E0E0 solid 1px;
text-align: center;
color: #0071BB;
}
.form {
display: flex;
flex-grow: 1;
padding: 24px;
}
.center {
width: 100%;
max-width: 416px;
margin: auto;
}
}
@media screen and (max-width: 959px) {
.authentication {
flex-direction: column;
justify-content: center;
.logo {
width: 100%;
height: auto;
border-right: none;
}
.form {
flex-grow: 0;
}
::ng-deep h2 {
text-align: center;
}
}
}

View File

@ -293,4 +293,146 @@ form-field-document{
margin: 0 0 16px;
}
}
}
auth-page{
.authentication {
display: flex;
flex-direction: row;
.logo {
display: flex;
width: 50%;
flex-shrink: 0;
height: 100%;
border-right: #E0E0E0 solid 1px;
text-align: center;
color: #0071BB;
}
.form {
display: flex;
flex-grow: 1;
padding: 24px;
}
.center {
width: 100%;
max-width: 416px;
margin: auto;
}
}
@media screen and (max-width: 959px) {
.authentication {
flex-direction: column;
justify-content: center;
.logo {
width: 100%;
height: auto;
border-right: none;
}
.form {
flex-grow: 0;
}
::ng-deep h2 {
text-align: center;
}
}
}
}
auth-page, auth-modal{
h2 {
margin: 0 0 24px;
font-size: 24px;
font-weight: normal;
}
.field {
margin: 0 0 16px;
label {
font-size: 14px;
color: #666666;
line-height: 20px;
}
.checkbox {
display: flex;
flex-direction: row;
gap: 12px;
margin: 0 0 12px;
&:last-child {margin: 0;}
label {
font-size: 0.875rem;
color: #86898E;
a {
color: #F9B417;
}
}
input {
flex-shrink: 0;
width: 20px;
height: 20px;
margin: 0;
padding: 0;
}
}
}
.error {
margin: 0 0 16px;
font-size: 14px;
color: #D91519;
text-align: center;
}
.bar {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
flex-wrap: wrap;
row-gap: 18px;
.remember {
display: flex;
flex-direction: row;
align-items: center;
input {
width: 16px;
height: 16px;
margin-right: 8px;
border-radius: 2px;
border: 1px solid #86898E;
}
}
.forget {
cursor: pointer;
display: flex;
justify-content: space-between;
flex-basis: 100%;
}
}
.bottom {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
gap: 24px;
margin: 24px 0 0;
}
@media screen and (max-width: 600px) {
.bottom {
flex-direction: column-reverse;
button {
width: 100%;
}
}
}
}