parent
b18a99e4df
commit
8b2f1965e2
@ -1,38 +1,38 @@
|
||||
<script>
|
||||
import { ApiError, AuthService } from "@odit/lfk-client-js";
|
||||
import { AuthService } from "@odit/lfk-client-js";
|
||||
import { _ } from "svelte-i18n";
|
||||
import Toastify from "toastify-js";
|
||||
import "toastify-js/src/toastify.css";
|
||||
import isEmail from "validator/es/lib/isEmail";
|
||||
let reset_success = false;
|
||||
let newPassword = "";
|
||||
let state = "reset_in_progress";
|
||||
let password = "";
|
||||
export let params;
|
||||
function set_new_password() {
|
||||
// if (isEmail(newPassword)) {
|
||||
// AuthService.authControllerGetResetToken({ email: newPassword })
|
||||
// .then((resp) => {
|
||||
// console.log(resp);
|
||||
// console.log(resp.resetToken);
|
||||
// Toastify({
|
||||
// text: $_("mail-validation-in-progress"),
|
||||
// duration: 3500,
|
||||
// }).showToast();
|
||||
reset_success = true;
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// console.log(err.body.name);
|
||||
// console.log(err.body.message);
|
||||
// });
|
||||
// } else {
|
||||
// Toastify({
|
||||
// text: $_("invalid-mail-reset"),
|
||||
// duration: 3500,
|
||||
// }).showToast();
|
||||
// }
|
||||
if(password.trim() !== ""){
|
||||
Toastify({
|
||||
text: "Password Reset in Progress...",
|
||||
duration: 3500,
|
||||
}).showToast();
|
||||
AuthService.authControllerResetPassword(params.resetkey,{ password })
|
||||
.then((resp) => {
|
||||
Toastify({
|
||||
text: "Password Reset successful!",
|
||||
duration: 3500,
|
||||
}).showToast();
|
||||
state="reset_success";
|
||||
})
|
||||
.catch((err) => {
|
||||
state="reset_error";
|
||||
});
|
||||
} else {
|
||||
Toastify({
|
||||
text: "Please provide a password...",
|
||||
duration: 3500,
|
||||
}).showToast();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if 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="" />
|
||||
@ -56,7 +56,31 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
{: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">
|
||||
{$_('application_name')}
|
||||
</p>
|
||||
<p class="mt-2 mb-2 text-sm text-center text-gray-900 font-bold">
|
||||
Password reset failed!
|
||||
</p>
|
||||
<p class="mt-2 mb-2 text-sm text-center text-gray-900">
|
||||
Please request a new reset mail...
|
||||
</p>
|
||||
<div class="mt-6">
|
||||
<div class="mt-6">
|
||||
<a
|
||||
href="/forgot_password/"
|
||||
class="text-center 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">
|
||||
Request a new reset mail
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</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="" />
|
||||
@ -76,7 +100,7 @@
|
||||
required=""
|
||||
class="border-gray-300 placeholder-gray-500 appearance-none rounded-md relative block w-full px-3 py-2 border text-gray-900 focus:outline-none focus:shadow-outline-blue focus:border-blue-300 focus:z-10 sm:text-sm"
|
||||
placeholder={$_('new-password')}
|
||||
bind:value={newPassword} />
|
||||
bind:value={password} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user