diff --git a/src/app/components/auth/login/login.component.html b/src/app/components/auth/login/login.component.html index dbf9993..0babdca 100644 --- a/src/app/components/auth/login/login.component.html +++ b/src/app/components/auth/login/login.component.html @@ -28,10 +28,9 @@ {{ alert.message }} - +
-
Enter secret key
@@ -40,7 +39,24 @@ Secret Key + + + + Password + + + Password is required + @@ -59,14 +75,31 @@
+ - - Menemonic + + + + Password + + + Password is required + @@ -76,6 +109,9 @@
+ + +
diff --git a/src/app/components/auth/login/login.component.ts b/src/app/components/auth/login/login.component.ts index 02ddb28..5f0ad3c 100644 --- a/src/app/components/auth/login/login.component.ts +++ b/src/app/components/auth/login/login.component.ts @@ -50,16 +50,17 @@ export class LoginComponent implements OnInit { private initializeForms(): void { this.SecretKeyLoginForm = this._formBuilder.group({ - secretKey: ['', [Validators.required, Validators.minLength(64)]], + secretKey: ['', [Validators.required, Validators.minLength(3)]], + password: ['', Validators.required] }); this.MenemonicLoginForm = this._formBuilder.group({ - menemonic: ['', [Validators.required, Validators.minLength(12)]], + menemonic: ['', [Validators.required, Validators.minLength(3)]], + password: ['', Validators.required] }); } private checkNostrExtensionAvailability(): void { - const globalContext = globalThis as unknown as { nostr?: { signEvent?: Function } }; if (globalContext.nostr && typeof globalContext.nostr.signEvent === 'function') { @@ -69,13 +70,13 @@ export class LoginComponent implements OnInit { } } - loginWithSecretKey(): void { if (this.SecretKeyLoginForm.invalid) { return; } - const secretKey = this.SecretKeyLoginForm.get('secretKey').value; + const secretKey = this.SecretKeyLoginForm.get('secretKey')?.value; + const password = this.SecretKeyLoginForm.get('password')?.value; this.loading = true; this.showAlert = false; @@ -96,7 +97,8 @@ export class LoginComponent implements OnInit { return; } - const menemonic = this.MenemonicLoginForm.get('menemonic').value; + const menemonic = this.MenemonicLoginForm.get('menemonic')?.value; + const password = this.MenemonicLoginForm.get('password')?.value; this.loading = true; this.showAlert = false; diff --git a/src/app/components/auth/register/register.component.html b/src/app/components/auth/register/register.component.html index 9069ea0..205cd25 100644 --- a/src/app/components/auth/register/register.component.html +++ b/src/app/components/auth/register/register.component.html @@ -1,9 +1,6 @@ -
+
+ class="w-full px-4 py-8 sm:bg-card sm:w-auto sm:rounded-2xl sm:p-12 sm:shadow md:flex md:h-full md:w-1/2 md:items-center md:justify-end md:rounded-none md:p-16 md:shadow-none">
@@ -11,168 +8,106 @@
-
+
Register
Already have an account?
- Login + Login
@if (showAlert) { - - {{ alert.message }} - + + {{ alert.message }} + } - -
- + + + Full name - @if (signUpForm.get('name').hasError('required')) { - Full name is required - } + Full name is required - + - Email address - - @if (signUpForm.get('email').hasError('required')) { - Email address is required - } - @if (signUpForm.get('email').hasError('email')) { - - Please enter a valid email address - - } + Username + + Username is required - + + + About + + + + + + Avatar URL + + + Password - - - Password is required - - - - - Company - + Password is required
- + I agree with - Terms - + Terms and - Privacy Policy - + Privacy Policy
-
+
diff --git a/src/app/components/auth/register/register.component.ts b/src/app/components/auth/register/register.component.ts index 188e1cd..73b1a83 100644 --- a/src/app/components/auth/register/register.component.ts +++ b/src/app/components/auth/register/register.component.ts @@ -37,60 +37,48 @@ import { AngorAlertComponent, AngorAlertType } from '@angor/components/alert'; ], }) export class RegisterComponent implements OnInit { - @ViewChild('signUpNgForm') signUpNgForm: NgForm; + @ViewChild('registerNgForm') registerNgForm: NgForm; alert: { type: AngorAlertType; message: string } = { type: 'success', message: '', }; - signUpForm: UntypedFormGroup; + registerForm: UntypedFormGroup; showAlert: boolean = false; - /** - * Constructor - */ - constructor( - private _formBuilder: UntypedFormBuilder, - private _router: Router - ) {} + constructor(private _formBuilder: UntypedFormBuilder, private _router: Router) {} - // ----------------------------------------------------------------------------------------------------- - // @ Lifecycle hooks - // ----------------------------------------------------------------------------------------------------- - - /** - * On init - */ ngOnInit(): void { - // Create the form - this.signUpForm = this._formBuilder.group({ + this.registerForm = this._formBuilder.group({ name: ['', Validators.required], - email: ['', [Validators.required, Validators.email]], + username: ['', Validators.required], + about: [''], + avatarUrl: [''], password: ['', Validators.required], - company: [''], agreements: ['', Validators.requiredTrue], }); } - // ----------------------------------------------------------------------------------------------------- - // @ Public methods - // ----------------------------------------------------------------------------------------------------- - - /** - * Sign up - */ - signUp(): void { - // Do nothing if the form is invalid - if (this.signUpForm.invalid) { + register(): void { + if (this.registerForm.invalid) { return; } - // Disable the form - this.signUpForm.disable(); + this.registerForm.disable(); - // Hide the alert this.showAlert = false; + const name = this.registerForm.get('name')?.value; + const username = this.registerForm.get('username')?.value; + const about = this.registerForm.get('about')?.value; + const avatarUrl = this.registerForm.get('avatarUrl')?.value; + const password = this.registerForm.get('password')?.value; + + console.log({ name, username, about, avatarUrl, password }); + + this.alert = { type: 'success', message: 'Account created successfully!' }; + this.showAlert = true; + this._router.navigateByUrl('/home'); } }