parent
b18a99e4df
commit
8b2f1965e2
@ -1,38 +1,38 @@
|
|||||||
<script>
|
<script>
|
||||||
import { ApiError, AuthService } from "@odit/lfk-client-js";
|
import { AuthService } from "@odit/lfk-client-js";
|
||||||
import { _ } from "svelte-i18n";
|
import { _ } from "svelte-i18n";
|
||||||
import Toastify from "toastify-js";
|
import Toastify from "toastify-js";
|
||||||
import "toastify-js/src/toastify.css";
|
import "toastify-js/src/toastify.css";
|
||||||
import isEmail from "validator/es/lib/isEmail";
|
let state = "reset_in_progress";
|
||||||
let reset_success = false;
|
let password = "";
|
||||||
let newPassword = "";
|
|
||||||
export let params;
|
export let params;
|
||||||
function set_new_password() {
|
function set_new_password() {
|
||||||
// if (isEmail(newPassword)) {
|
if(password.trim() !== ""){
|
||||||
// AuthService.authControllerGetResetToken({ email: newPassword })
|
Toastify({
|
||||||
// .then((resp) => {
|
text: "Password Reset in Progress...",
|
||||||
// console.log(resp);
|
duration: 3500,
|
||||||
// console.log(resp.resetToken);
|
}).showToast();
|
||||||
// Toastify({
|
AuthService.authControllerResetPassword(params.resetkey,{ password })
|
||||||
// text: $_("mail-validation-in-progress"),
|
.then((resp) => {
|
||||||
// duration: 3500,
|
Toastify({
|
||||||
// }).showToast();
|
text: "Password Reset successful!",
|
||||||
reset_success = true;
|
duration: 3500,
|
||||||
// })
|
}).showToast();
|
||||||
// .catch((err) => {
|
state="reset_success";
|
||||||
// console.log(err.body.name);
|
})
|
||||||
// console.log(err.body.message);
|
.catch((err) => {
|
||||||
// });
|
state="reset_error";
|
||||||
// } else {
|
});
|
||||||
// Toastify({
|
} else {
|
||||||
// text: $_("invalid-mail-reset"),
|
Toastify({
|
||||||
// duration: 3500,
|
text: "Please provide a password...",
|
||||||
// }).showToast();
|
duration: 3500,
|
||||||
// }
|
}).showToast();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if reset_success}
|
{#if state==="reset_success"}
|
||||||
<div class="min-h-screen flex items-center justify-center bg-gray-100">
|
<div class="min-h-screen flex items-center justify-center bg-gray-100">
|
||||||
<div class="max-w-md w-full py-12 px-6">
|
<div class="max-w-md w-full py-12 px-6">
|
||||||
<img style="height:10rem;" class="mx-auto" src="/lfk-logo.png" alt="" />
|
<img style="height:10rem;" class="mx-auto" src="/lfk-logo.png" alt="" />
|
||||||
@ -56,7 +56,31 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</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="min-h-screen flex items-center justify-center bg-gray-100">
|
||||||
<div class="max-w-md w-full py-12 px-6">
|
<div class="max-w-md w-full py-12 px-6">
|
||||||
<img style="height:10rem;" class="mx-auto" src="/lfk-logo.png" alt="" />
|
<img style="height:10rem;" class="mx-auto" src="/lfk-logo.png" alt="" />
|
||||||
@ -76,7 +100,7 @@
|
|||||||
required=""
|
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"
|
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')}
|
placeholder={$_('new-password')}
|
||||||
bind:value={newPassword} />
|
bind:value={password} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user