diff --git a/package.json b/package.json index d5f35af7..651103ee 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "@odit/lfk-client-js": "^0.0.4", "svelte-i18n": "^3.3.0", "svelte-spa-router": "^3.1.0", - "toastify-js": "^1.9.3" + "toastify-js": "^1.9.3", + "validator": "^13.5.2" }, "devDependencies": { "svelte": "^3.29.7", diff --git a/src/App.svelte b/src/App.svelte index e1e7bd87..11531577 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -36,6 +36,7 @@ "/forgot_password": ForgotPassword, "/dashboard": wrap({ component: Dashboard, conditions: [checkAuth] }), "/": wrap({ component: Dashboard, conditions: [checkAuth] }), + // "/password_reset_sent/*": Book, // Using named parameters, with last being optional // "/author/:first/:last?": Author, diff --git a/src/components/ForgotPassword.svelte b/src/components/ForgotPassword.svelte index 41a6cd39..2503222c 100644 --- a/src/components/ForgotPassword.svelte +++ b/src/components/ForgotPassword.svelte @@ -5,89 +5,128 @@ import { push, pop, replace } from "svelte-spa-router"; // import { OpenAPI, AuthService } from "@odit/lfk-client-js"; - OpenAPI.BASE = "http://localhost:4010"; + import isEmail from "validator/es/lib/isEmail"; + // import Toastify from "toastify-js"; import "toastify-js/src/toastify.css"; - let usersUsername = ""; + let reset_mail_sent = false; + let usersEmail = ""; function reset() { - Toastify({ - text: "mail validation in progress...", - duration: 3500, - }).showToast(); + if (isEmail(usersEmail)) { + Toastify({ + text: $_("mail-validation-in-progress"), + duration: 3500, + }).showToast(); + reset_mail_sent = true; + } else { + Toastify({ + text: $_('invalid-mail-reset'), + duration: 3500, + }).showToast(); + } } -
- {$_('application_name')} -
-- {$_('forgot_password?')} -
-- {$_('dont-panic-were-resetting-it')} -
-+ {$_('application_name')} +
++ Passwort-Reset Mail wurde an + {usersEmail} + geschickt +
+ {$_('application_name')} +
++ {$_('forgot_password?')} +
++ {$_('dont-panic-were-resetting-it')} +
+