Polish Round 1 (#2396)
This commit is contained in:
parent
cf2c43d390
commit
02b002d81a
197 changed files with 1233 additions and 1751 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, inject} from '@angular/core';
|
||||
import { FormGroup, FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
|
|
@ -9,6 +9,7 @@ import { NgbTooltip } from '@ng-bootstrap/ng-bootstrap';
|
|||
import { NgIf, NgTemplateOutlet } from '@angular/common';
|
||||
import { SplashContainerComponent } from '../splash-container/splash-container.component';
|
||||
import {translate, TranslocoDirective} from "@ngneat/transloco";
|
||||
import {NavService} from "../../../_services/nav.service";
|
||||
|
||||
/**
|
||||
* This is exclusively used to register the first user on the server and nothing else
|
||||
|
|
@ -29,9 +30,14 @@ export class RegisterComponent {
|
|||
password: new FormControl('', [Validators.required, Validators.maxLength(32), Validators.minLength(6), Validators.pattern("^.{6,32}$")]),
|
||||
});
|
||||
|
||||
private readonly navService = inject(NavService);
|
||||
|
||||
constructor(private router: Router, private accountService: AccountService,
|
||||
private toastr: ToastrService, private memberService: MemberService) {
|
||||
|
||||
this.navService.hideNavBar();
|
||||
this.navService.hideSideNav();
|
||||
|
||||
this.memberService.adminExists().pipe(take(1)).subscribe(adminExists => {
|
||||
if (adminExists) {
|
||||
this.router.navigateByUrl('login');
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ConfirmEmailComponent } from './_components/confirm-email/confirm-email.component';
|
||||
import { RegistrationRoutingModule } from './registration.router.module';
|
||||
import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { UserLoginComponent } from './user-login/user-login.component';
|
||||
import { ConfirmEmailChangeComponent } from './_components/confirm-email-change/confirm-email-change.component';
|
||||
import { ConfirmMigrationEmailComponent } from './_components/confirm-migration-email/confirm-migration-email.component';
|
||||
import { ConfirmResetPasswordComponent } from './_components/confirm-reset-password/confirm-reset-password.component';
|
||||
import { RegisterComponent } from './_components/register/register.component';
|
||||
import { ResetPasswordComponent } from './_components/reset-password/reset-password.component';
|
||||
import { SplashContainerComponent } from './_components/splash-container/splash-container.component';
|
||||
import {TranslocoModule} from "@ngneat/transloco";
|
||||
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
RegistrationRoutingModule,
|
||||
NgbTooltipModule,
|
||||
ReactiveFormsModule,
|
||||
ConfirmEmailComponent,
|
||||
SplashContainerComponent,
|
||||
RegisterComponent,
|
||||
ConfirmMigrationEmailComponent,
|
||||
ResetPasswordComponent,
|
||||
ConfirmResetPasswordComponent,
|
||||
UserLoginComponent,
|
||||
ConfirmEmailChangeComponent,
|
||||
TranslocoModule
|
||||
],
|
||||
exports: [
|
||||
SplashContainerComponent
|
||||
],
|
||||
})
|
||||
export class RegistrationModule { }
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { UserLoginComponent } from './user-login/user-login.component';
|
||||
import { ConfirmEmailChangeComponent } from './_components/confirm-email-change/confirm-email-change.component';
|
||||
import { ConfirmEmailComponent } from './_components/confirm-email/confirm-email.component';
|
||||
import { ConfirmMigrationEmailComponent } from './_components/confirm-migration-email/confirm-migration-email.component';
|
||||
import { ConfirmResetPasswordComponent } from './_components/confirm-reset-password/confirm-reset-password.component';
|
||||
import { RegisterComponent } from './_components/register/register.component';
|
||||
import { ResetPasswordComponent } from './_components/reset-password/reset-password.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: UserLoginComponent
|
||||
},
|
||||
{
|
||||
path: 'login',
|
||||
component: UserLoginComponent
|
||||
},
|
||||
{
|
||||
path: 'confirm-email',
|
||||
component: ConfirmEmailComponent,
|
||||
},
|
||||
{
|
||||
path: 'confirm-migration-email',
|
||||
component: ConfirmMigrationEmailComponent,
|
||||
},
|
||||
{
|
||||
path: 'confirm-email-update',
|
||||
component: ConfirmEmailChangeComponent,
|
||||
},
|
||||
{
|
||||
path: 'register',
|
||||
component: RegisterComponent,
|
||||
},
|
||||
{
|
||||
path: 'reset-password',
|
||||
component: ResetPasswordComponent
|
||||
},
|
||||
{
|
||||
path: 'confirm-reset-password',
|
||||
component: ConfirmResetPasswordComponent
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes), ],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class RegistrationRoutingModule { }
|
||||
|
|
@ -40,18 +40,16 @@ export class UserLoginComponent implements OnInit {
|
|||
constructor(private accountService: AccountService, private router: Router, private memberService: MemberService,
|
||||
private toastr: ToastrService, private navService: NavService,
|
||||
private readonly cdRef: ChangeDetectorRef, private route: ActivatedRoute) {
|
||||
this.navService.showNavBar();
|
||||
this.navService.hideNavBar();
|
||||
this.navService.hideSideNav();
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.navService.showNavBar();
|
||||
this.navService.hideSideNav();
|
||||
this.cdRef.markForCheck();
|
||||
|
||||
this.accountService.currentUser$.pipe(take(1)).subscribe(user => {
|
||||
if (user) {
|
||||
this.navService.showNavBar();
|
||||
this.navService.showSideNav();
|
||||
this.router.navigateByUrl('/home');
|
||||
this.cdRef.markForCheck();
|
||||
}
|
||||
});
|
||||
|
|
@ -96,7 +94,7 @@ export class UserLoginComponent implements OnInit {
|
|||
this.router.navigateByUrl(pageResume);
|
||||
} else {
|
||||
localStorage.setItem('kavita--auth-intersection-url', '');
|
||||
this.router.navigateByUrl('/libraries');
|
||||
this.router.navigateByUrl('/home');
|
||||
}
|
||||
this.isSubmitting = false;
|
||||
this.cdRef.markForCheck();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue