mirror of
https://github.com/umami-software/umami.git
synced 2026-02-18 11:35:37 +01:00
Autologin via ?hash=xxx parameter in url
This commit is contained in:
parent
2575cbfc11
commit
6bd01aaa45
8 changed files with 64 additions and 4 deletions
|
|
@ -27,11 +27,25 @@ const validate = ({ username, password }) => {
|
|||
return errors;
|
||||
};
|
||||
|
||||
export default function LoginForm() {
|
||||
export default function LoginForm({ hash = null }) {
|
||||
const post = usePost();
|
||||
const router = useRouter();
|
||||
const [message, setMessage] = useState();
|
||||
|
||||
const handleAutologin = async ({ hash }) => {
|
||||
const autologin = await post('/api/auth/hash', {
|
||||
hash,
|
||||
});
|
||||
|
||||
if (autologin.ok) {
|
||||
return router.push('/');
|
||||
}
|
||||
};
|
||||
|
||||
if (hash) {
|
||||
handleAutologin({ hash });
|
||||
}
|
||||
|
||||
const handleSubmit = async ({ username, password }) => {
|
||||
const { ok, status, data } = await post('/api/auth/login', {
|
||||
username,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue