basic ForgotPassword improvements
All checks were successful
continuous-integration/drone/push Build is passing

validation, steps towards error handlind
This commit is contained in:
Philipp Dormann 2021-01-08 17:32:31 +01:00
parent b107f5de95
commit e8c98a0a29

View File

@ -1,23 +1,28 @@
<script>
import { ApiError, AuthService } from "@odit/lfk-client-js";
import { _ } from "svelte-i18n";
import store from "../store.js";
store.init();
//
import { OpenAPI, AuthService } from "@odit/lfk-client-js";
import isEmail from "validator/es/lib/isEmail";
//
import Toastify from "toastify-js";
import "toastify-js/src/toastify.css";
import isEmail from "validator/es/lib/isEmail";
let reset_mail_sent = false;
let usersEmail = "";
function reset() {
if (isEmail(usersEmail)) {
AuthService.authControllerGetResetToken({ email: usersEmail })
.then((resp) => {
console.log(resp);
console.log(resp.resetToken);
Toastify({
text: $_("mail-validation-in-progress"),
duration: 3500,
}).showToast();
reset_mail_sent = true;
})
.catch((err) => {
console.log(err.body.name);
console.log(err.body.message);
});
} else {
Toastify({
text: $_("invalid-mail-reset"),
@ -30,11 +35,7 @@
{#if reset_mail_sent}
<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="" />
<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>
@ -57,11 +58,7 @@
{:else}
<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="" />
<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>