2025-11-27 13:48:24 +07:00
|
|
|
'use client'
|
|
|
|
|
|
|
|
|
|
import styles from '@/app/styles/login.module.scss'
|
|
|
|
|
import { useActionState } from 'react';
|
2025-11-27 21:33:53 +07:00
|
|
|
import { authorization } from '@/app/actions/auth';
|
2025-11-27 13:48:24 +07:00
|
|
|
|
|
|
|
|
export default function LoginForm() {
|
|
|
|
|
const [errorMessage, formAction, isPending] = useActionState(
|
2025-11-27 21:33:53 +07:00
|
|
|
authorization,
|
2025-11-27 13:48:24 +07:00
|
|
|
undefined,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<form action={formAction}>
|
|
|
|
|
<div className={`${styles['form-group']}`}>
|
|
|
|
|
<label className={`${styles['form-label']}`}>Email адрес</label>
|
|
|
|
|
<input type="readOnly" id="email" name="email" className={`${styles['form-input']}`} placeholder="Введите ваш email" />
|
|
|
|
|
</div>
|
|
|
|
|
<div className={`${styles['form-group']}`}>
|
|
|
|
|
<label className={`${styles['form-label']}`}>Пароль</label>
|
|
|
|
|
<input type="password" id="password" name="password" className={`${styles['form-input']}`} placeholder="Введите пароль" />
|
|
|
|
|
</div>
|
|
|
|
|
{errorMessage && (
|
|
|
|
|
<p className="text-sm text-red-500">{errorMessage}</p>
|
|
|
|
|
)}
|
|
|
|
|
<div className={`${styles['form-options']}`}>
|
|
|
|
|
<div className={`${styles['form-checkbox']}`}>
|
|
|
|
|
<input type="checkbox" id="remember" name="remember" />
|
|
|
|
|
<label>Запомнить меня</label>
|
|
|
|
|
</div>
|
|
|
|
|
<a href="forgot-password" className={`${styles['forgot-password']}`} >Забыли пароль?</a>
|
|
|
|
|
</div>
|
|
|
|
|
<button type="submit" className={`${styles['btn']}`}>Войти в систему</button>
|
|
|
|
|
</form>
|
|
|
|
|
)
|
|
|
|
|
}
|