From 952949b609b0ac8cd53e0c080f0d614464cdf159 Mon Sep 17 00:00:00 2001 From: mstar Date: Mon, 28 Oct 2024 08:36:11 +0100 Subject: [PATCH] Work on login form stuff --- frontend-reactive/app/components/auth.ts | 1 + .../app/components/auth/login.hbs | 12 +++++++ .../app/components/auth/login.ts | 24 ++++++++++++++ ...on-form.hbs => post-registration-form.hbs} | 31 +++++++++---------- ...tion-form.ts => post-registration-form.ts} | 4 +-- .../app/components/auth/register-start.hbs | 1 + .../app/components/auth/register-start.ts | 14 +++++++++ .../app/templates/registerform.hbs | 4 ++- .../integration/components/auth/login-test.ts | 26 ++++++++++++++++ ...test.ts => post-registration-form-test.ts} | 6 ++-- .../components/auth/register-start-test.ts | 26 ++++++++++++++++ 11 files changed, 127 insertions(+), 22 deletions(-) create mode 100644 frontend-reactive/app/components/auth/login.hbs create mode 100644 frontend-reactive/app/components/auth/login.ts rename frontend-reactive/app/components/auth/{registration-form.hbs => post-registration-form.hbs} (67%) rename frontend-reactive/app/components/auth/{registration-form.ts => post-registration-form.ts} (90%) create mode 100644 frontend-reactive/app/components/auth/register-start.hbs create mode 100644 frontend-reactive/app/components/auth/register-start.ts create mode 100644 frontend-reactive/tests/integration/components/auth/login-test.ts rename frontend-reactive/tests/integration/components/auth/{registration-form-test.ts => post-registration-form-test.ts} (84%) create mode 100644 frontend-reactive/tests/integration/components/auth/register-start-test.ts diff --git a/frontend-reactive/app/components/auth.ts b/frontend-reactive/app/components/auth.ts index 90ac277..65145c3 100644 --- a/frontend-reactive/app/components/auth.ts +++ b/frontend-reactive/app/components/auth.ts @@ -23,6 +23,7 @@ export interface PasskeySignature { export default class Auth extends Component { @tracked username: string = ''; @tracked error: string | undefined; + @tracked isLogin = true; @service declare auth: AuthService; @action async startLogin() { diff --git a/frontend-reactive/app/components/auth/login.hbs b/frontend-reactive/app/components/auth/login.hbs new file mode 100644 index 0000000..452cb2b --- /dev/null +++ b/frontend-reactive/app/components/auth/login.hbs @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/frontend-reactive/app/components/auth/login.ts b/frontend-reactive/app/components/auth/login.ts new file mode 100644 index 0000000..f033473 --- /dev/null +++ b/frontend-reactive/app/components/auth/login.ts @@ -0,0 +1,24 @@ +import { action } from '@ember/object' +import Component from '@glimmer/component' +import { tracked } from '@glimmer/tracking' + +export interface AuthLoginSignature { + // The arguments accepted by the component + Args: {} + // Any blocks yielded by the component + Blocks: { + default: [] + } + // The element to which `...attributes` is applied in the component template + Element: null +} + +export default class AuthLogin extends Component { + @tracked username = '' + + @action onLoginStart() { + console.log('Starting login for username ' + this.username) + // Check if username is approved for login + // If it is, continue with login + } +} diff --git a/frontend-reactive/app/components/auth/registration-form.hbs b/frontend-reactive/app/components/auth/post-registration-form.hbs similarity index 67% rename from frontend-reactive/app/components/auth/registration-form.hbs rename to frontend-reactive/app/components/auth/post-registration-form.hbs index 4fe281f..465589d 100644 --- a/frontend-reactive/app/components/auth/registration-form.hbs +++ b/frontend-reactive/app/components/auth/post-registration-form.hbs @@ -1,6 +1,6 @@

username: {{this.args.username}}

-
+
-
+
-
- -
-
+ {{!--
--}} + {{!-- --}} + {{!--
--}} +

{{this.extracted}}

-
+
-
+
-