mirror of
https://github.com/Kareadita/Kavita.git
synced 2026-04-11 03:31:46 -04:00
* Added a no data section to collection detail. * Remove an optimization for skipping the whole library scan as it wasn't reliable * When resetting password, ensure the input is colored correctly * Fixed setting new password after resetting, throwing an error despite it actually being successful. Fixed incorrect messaging for Password Reset page. * Fixed a bug where reset password would show the side nav button and skew the page. Updated a lot of references to use Typed version for formcontrols. * Removed a migration from 0.5.0, 6 releases ago. * Added a null check so we don't throw an exception when connecting with signalR on unauthenticated users.
48 lines
1.6 KiB
TypeScript
48 lines
1.6 KiB
TypeScript
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
|
import { FormGroup, FormControl, Validators } from '@angular/forms';
|
|
import { Router } from '@angular/router';
|
|
import { ToastrService } from 'ngx-toastr';
|
|
import { take } from 'rxjs/operators';
|
|
import { AccountService } from 'src/app/_services/account.service';
|
|
import { MemberService } from 'src/app/_services/member.service';
|
|
|
|
/**
|
|
* This is exclusivly used to register the first user on the server and nothing else
|
|
*/
|
|
@Component({
|
|
selector: 'app-register',
|
|
templateUrl: './register.component.html',
|
|
styleUrls: ['./register.component.scss'],
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
})
|
|
export class RegisterComponent implements OnInit {
|
|
|
|
registerForm: FormGroup = new FormGroup({
|
|
email: new FormControl('', [Validators.required, Validators.email]),
|
|
username: new FormControl('', [Validators.required]),
|
|
password: new FormControl('', [Validators.required, Validators.maxLength(32), Validators.minLength(6)]),
|
|
});
|
|
|
|
constructor(private router: Router, private accountService: AccountService,
|
|
private toastr: ToastrService, private memberService: MemberService) {
|
|
|
|
this.memberService.adminExists().pipe(take(1)).subscribe(adminExists => {
|
|
if (adminExists) {
|
|
this.router.navigateByUrl('login');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
}
|
|
|
|
submit() {
|
|
const model = this.registerForm.getRawValue();
|
|
this.accountService.register(model).subscribe((user) => {
|
|
this.toastr.success('Account registration complete');
|
|
this.router.navigateByUrl('login');
|
|
});
|
|
}
|
|
}
|