1
0
Fork 0
mirror of synced 2024-07-03 13:30:46 +12:00

fix erroneous disable state in resetform

This commit is contained in:
Keviin Åberg Kultalahti 2021-05-21 13:25:40 +02:00
parent 3593073c00
commit 06c9af9670
2 changed files with 12 additions and 4 deletions

View file

@ -12,8 +12,11 @@
async function reset() {
try {
if (forceResetPassword) {
console.log("Updating self!")
await auth.updateSelf({ ...$auth.user, password })
await auth.updateSelf({
...$auth.user,
password,
forceResetPassword: false,
})
$goto("../portal/")
} else {
await auth.resetPassword(password, resetCode)
@ -43,7 +46,12 @@
</Body>
<PasswordRepeatInput bind:password bind:error />
</Layout>
<Button cta on:click={reset} disabled={error}>Reset your password</Button>
<Button
cta
on:click={reset}
disabled={error || (forceResetPassword ? false : !resetCode)}
>Reset your password</Button
>
</Layout>
</div>
</div>

View file

@ -53,7 +53,7 @@ export function createAuthStore() {
resetPassword: async (password, code) => {
const response = await api.post(`/api/admin/auth/reset/update`, {
password,
resetCode: code,
resetCode: code
})
if (response.status !== 200) {
throw "Unable to reset password"