parent
b2509e9e53
commit
75d8f7331b
@ -3,37 +3,41 @@
|
||||
import { _ } from "svelte-i18n";
|
||||
import Toastify from "toastify-js";
|
||||
import "toastify-js/src/toastify.css";
|
||||
import PasswordStrength from "../auth/PasswordStrength.svelte";
|
||||
import PasswordStrength, {
|
||||
password_strong_enough,
|
||||
} from "../auth/PasswordStrength.svelte";
|
||||
let state = "reset_in_progress";
|
||||
let password = "";
|
||||
export let params;
|
||||
function set_new_password() {
|
||||
if(password.trim() !== ""){
|
||||
if (password.trim() !== "") {
|
||||
Toastify({
|
||||
text: $_('password-reset-in-progress'),
|
||||
text: $_("password-reset-in-progress"),
|
||||
duration: 3500,
|
||||
}).showToast();
|
||||
AuthService.authControllerResetPassword(atob(params.resetkey),{ password })
|
||||
AuthService.authControllerResetPassword(atob(params.resetkey), {
|
||||
password,
|
||||
})
|
||||
.then((resp) => {
|
||||
Toastify({
|
||||
text: $_('password-reset-successful'),
|
||||
text: $_("password-reset-successful"),
|
||||
duration: 3500,
|
||||
}).showToast();
|
||||
state="reset_success";
|
||||
state = "reset_success";
|
||||
})
|
||||
.catch((err) => {
|
||||
state="reset_error";
|
||||
state = "reset_error";
|
||||
});
|
||||
} else {
|
||||
Toastify({
|
||||
text: $_('please-provide-a-password'),
|
||||
text: $_("please-provide-a-password"),
|
||||
duration: 3500,
|
||||
}).showToast();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if state==="reset_success"}
|
||||
{#if state === 'reset_success'}
|
||||
<div class="min-h-screen flex items-center justify-center bg-gray-100">
|
||||
<div class="max-w-md w-full py-12 px-6">
|
||||
<img style="height:10rem;" class="mx-auto" src="/lfk-logo.png" alt="" />
|
||||
@ -57,8 +61,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{:else if state==="reset_error"}
|
||||
<div class="min-h-screen flex items-center justify-center bg-gray-100">
|
||||
{:else if state === 'reset_error'}
|
||||
<div class="min-h-screen flex items-center justify-center bg-gray-100">
|
||||
<div class="max-w-md w-full py-12 px-6">
|
||||
<img style="height:10rem;" class="mx-auto" src="/lfk-logo.png" alt="" />
|
||||
<p class="mt-6 text-lg text-center font-bold text-gray-900">
|
||||
@ -80,8 +84,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{:else if state==="reset_in_progress"}
|
||||
</div>
|
||||
{:else if state === 'reset_in_progress'}
|
||||
<div class="min-h-screen flex items-center justify-center bg-gray-100">
|
||||
<div class="max-w-md w-full py-12 px-6">
|
||||
<img style="height:10rem;" class="mx-auto" src="/lfk-logo.png" alt="" />
|
||||
@ -109,6 +113,8 @@
|
||||
<div class="mt-5">
|
||||
<button
|
||||
on:click={set_new_password}
|
||||
disabled={!password_strong_enough(password)}
|
||||
class:opacity-50={!password_strong_enough(password)}
|
||||
type="submit"
|
||||
class="relative block w-full py-2 px-3 border border-transparent rounded-md text-white font-semibold bg-gray-800 hover:bg-gray-700 focus:bg-gray-900 focus:outline-none focus:shadow-outline sm:text-sm">
|
||||
<span class="absolute left-0 inset-y pl-3">
|
||||
|
Loading…
x
Reference in New Issue
Block a user