Implement direct login functionality with email and password

- Update login API to support direct authentication via email and password, removing the OAuth2 redirect flow.
- Modify LoginForm component to include password field and validation.
- Refactor useAuth composable to handle login with both email and password.
- Remove unnecessary OAuth2 callback handler and PKCE utilities.
- Update relevant documentation and error handling for the new login method.
This commit is contained in:
Bastian Masanek
2025-10-31 14:27:38 +01:00
parent e71316dfe7
commit 7c7c4fcb6f
8 changed files with 178 additions and 268 deletions

View File

@@ -11,6 +11,7 @@ const { login } = useAuth()
const loginSchema = toTypedSchema(
z.object({
email: z.string().email('Bitte geben Sie eine gültige E-Mail-Adresse ein'),
password: z.string().min(8, 'Passwort muss mindestens 8 Zeichen lang sein'),
})
)
@@ -27,7 +28,7 @@ const onSubmit = handleSubmit(async (values) => {
submitError.value = null
try {
await login(values.email)
await login(values.email, values.password)
// Redirect happens in login() function
} catch (error: any) {
console.error('Login error:', error)
@@ -55,6 +56,17 @@ const onSubmit = handleSubmit(async (values) => {
</FormItem>
</FormField>
<!-- Password Field -->
<FormField v-slot="{ componentField }" name="password">
<FormItem>
<FormLabel class="text-white/90 text-base font-medium">Passwort</FormLabel>
<FormControl>
<Input type="password" placeholder="••••••••" v-bind="componentField" />
</FormControl>
<FormMessage />
</FormItem>
</FormField>
<!-- Submit Button -->
<Button type="submit" variant="experimenta" size="experimenta" class="w-full" :disabled="isSubmitting">
<Loader2 v-if="isSubmitting" class="mr-2 h-5 w-5 animate-spin" />
@@ -63,7 +75,7 @@ const onSubmit = handleSubmit(async (values) => {
<!-- Info Text -->
<p class="text-sm text-white/70 text-center">
Sie werden zur sicheren Anmeldeseite weitergeleitet
Anmeldung erfolgt verschlüsselt über unseren Partner Cidaas
</p>
</form>
</template>