From b18a99e4df6111e137a8081c3e6619da6f5af30c Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Sun, 7 Feb 2021 12:51:21 +0100 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9C=A8=20added=20basic=20UI=20for=20Rese?= =?UTF-8?q?tPassword?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #43 --- src/App.svelte | 5 ++ src/components/ResetPassword.svelte | 105 ++++++++++++++++++++++++++++ src/locales/en.json | 2 + 3 files changed, 112 insertions(+) create mode 100644 src/components/ResetPassword.svelte diff --git a/src/App.svelte b/src/App.svelte index 78f36281..790744db 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -52,6 +52,7 @@ import RunnerDetail from "./components/RunnerDetail.svelte"; import Imprint from "./components/Imprint.svelte"; import Privacy from "./components/Privacy.svelte"; +import ResetPassword from "./components/ResetPassword.svelte"; store.init(); registerSW(); @@ -61,6 +62,10 @@ + {:else if $router.path.includes('/reset')} + + + {:else if $router.path === '/about'} diff --git a/src/components/ResetPassword.svelte b/src/components/ResetPassword.svelte new file mode 100644 index 00000000..b49ceffe --- /dev/null +++ b/src/components/ResetPassword.svelte @@ -0,0 +1,105 @@ + + +{#if reset_success} +
+
+ +

+ {$_('application_name')} +

+

+ Successful password reset! +

+

+ You can now use your new password to log in to your account! 🎉 +

+ +
+
+{:else} +
+
+ +

+ {$_('application_name')} +

+

+ {$_('reset-password')} +

+
+
+
+ +
+
+ +
+ +
+
+
+
+{/if} diff --git a/src/locales/en.json b/src/locales/en.json index 215fa57a..68ac61e6 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -115,6 +115,7 @@ "middle-name": "Middle name", "minimum-lap-time-in-s": "minimum lap time in s", "name": "Name", + "new-password": "New password", "no-license-text-could-be-found": "No license text could be found 😢", "no-tracks-added-yet": "there are no tracks added yet.", "organization": "Organization", @@ -135,6 +136,7 @@ "register": "Register", "repo_link": "Link", "reset-my-password": "Reset my password", + "reset-password": "Reset your password", "runner-import": "Runner Import", "runner-updated": "Runner updated!", "runnerimport_verify_runners_org": "Please confirm these runners for import into the organization \"{org_name}\"", -- 2.47.2 From 8b2f1965e2a754da6e40a3051e8ae3e771d70336 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Sun, 7 Feb 2021 13:08:44 +0100 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=91=80=20ResetPassword=20-=20success?= =?UTF-8?q?=20and=20error=20states?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #43 --- src/components/ResetPassword.svelte | 80 +++++++++++++++++++---------- 1 file changed, 52 insertions(+), 28 deletions(-) diff --git a/src/components/ResetPassword.svelte b/src/components/ResetPassword.svelte index b49ceffe..3b1e4ca9 100644 --- a/src/components/ResetPassword.svelte +++ b/src/components/ResetPassword.svelte @@ -1,38 +1,38 @@ -{#if reset_success} +{#if state==="reset_success"}
@@ -56,7 +56,31 @@
-{:else} +{:else if state==="reset_error"} +
+
+ +

+ {$_('application_name')} +

+

+ Password reset failed! +

+

+ Please request a new reset mail... +

+ +
+
+{:else if state==="reset_in_progress"}
@@ -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} />
-- 2.47.2 From 428a8a10ffa96ae2f04c718d678439d36e6cb857 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Sun, 7 Feb 2021 13:11:08 +0100 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=8C=8D=20i18n=20for=20ResetPassword?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #43 --- src/components/ResetPassword.svelte | 18 +++++++++--------- src/locales/en.json | 9 +++++++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/components/ResetPassword.svelte b/src/components/ResetPassword.svelte index 3b1e4ca9..64ca4583 100644 --- a/src/components/ResetPassword.svelte +++ b/src/components/ResetPassword.svelte @@ -9,13 +9,13 @@ function set_new_password() { if(password.trim() !== ""){ Toastify({ - text: "Password Reset in Progress...", + text: $_('password-reset-in-progress'), duration: 3500, }).showToast(); AuthService.authControllerResetPassword(params.resetkey,{ password }) .then((resp) => { Toastify({ - text: "Password Reset successful!", + text: $_('password-reset-successful'), duration: 3500, }).showToast(); state="reset_success"; @@ -25,7 +25,7 @@ }); } else { Toastify({ - text: "Please provide a password...", + text: $_('please-provide-a-password'), duration: 3500, }).showToast(); } @@ -40,17 +40,17 @@ {$_('application_name')}

- Successful password reset! + {$_('successful-password-reset')}

- You can now use your new password to log in to your account! 🎉 + {$_('you-can-now-use-your-new-password-to-log-in-to-your-account')}

@@ -64,17 +64,17 @@ {$_('application_name')}

- Password reset failed! + {$_('password-reset-failed')}

- Please request a new reset mail... + {$_('please-request-a-new-reset-mail')}

diff --git a/src/locales/en.json b/src/locales/en.json index 68ac61e6..dd9ccd3e 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -89,6 +89,7 @@ "forgot_password?": "Forgot your password?", "general-stats": "General Stats", "general_promise_error": "😢 Error", + "go-to-login": "Go To Login", "goback": "Go Home", "group": "Group", "groups": "Groups", @@ -124,17 +125,23 @@ "oss_credit_description": "We use a lot of open source software on these projects, and would like to thank the following projects and contributors who help make open source great!", "password": "Password", "password-is-required": "Password is required", + "password-reset-failed": "Password reset failed!", + "password-reset-in-progress": "Password Reset in Progress...", + "password-reset-successful": "Password Reset successful!", "permissions": "Permissions", "phone": "Phone", + "please-provide-a-password": "Please provide a password...", "please-provide-the-required-csv-xlsx-file": "Please provide the required csv/ xlsx file", "please-provide-the-required-information-to-add-a-new-runner": "Please provide the required information to add a new runner.", "please-provide-the-required-information-to-add-a-new-track": "Please provide the required information to add a new track.", + "please-request-a-new-reset-mail": "Please request a new reset mail...", "privacy": "Privacy 🔒", "privacy-loading": "Privacy loading...", "profile-picture": "Profile Picture", "read-license": "Read License", "register": "Register", "repo_link": "Link", + "request-a-new-reset-mail": "Request a new reset mail", "reset-my-password": "Reset my password", "reset-password": "Reset your password", "runner-import": "Runner Import", @@ -146,6 +153,7 @@ "settings": "Settings", "signout": "Sign out", "stats-are-being-loaded": "stats are being loaded...", + "successful-password-reset": "Successful password reset!", "team": "Team", "team-name": "Team name", "teams": "Teams", @@ -167,5 +175,6 @@ "users": "Users", "valid-email-is-required": "valid email is required", "welcome_wavinghand": "Welcome 👋", + "you-can-now-use-your-new-password-to-log-in-to-your-account": "You can now use your new password to log in to your account! 🎉", "your_profile": "Your Profile" } \ No newline at end of file -- 2.47.2 From 7b7e4840918b21951fa9e267044d623e9de7b0f5 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Sun, 7 Feb 2021 13:25:39 +0100 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=A7=B9=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App.svelte b/src/App.svelte index 790744db..e88cfdea 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -63,7 +63,7 @@ import ResetPassword from "./components/ResetPassword.svelte";
{:else if $router.path.includes('/reset')} - + {:else if $router.path === '/about'} -- 2.47.2 From 92fee08dc40cf04fa1dc6d6e4aaf19f0b752031f Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Sun, 7 Feb 2021 13:26:57 +0100 Subject: [PATCH 5/5] =?UTF-8?q?=E2=8F=AEdecode=20base64=20reset=20key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ResetPassword.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ResetPassword.svelte b/src/components/ResetPassword.svelte index 64ca4583..ad8b9792 100644 --- a/src/components/ResetPassword.svelte +++ b/src/components/ResetPassword.svelte @@ -12,7 +12,7 @@ text: $_('password-reset-in-progress'), duration: 3500, }).showToast(); - AuthService.authControllerResetPassword(params.resetkey,{ password }) + AuthService.authControllerResetPassword(atob(params.resetkey),{ password }) .then((resp) => { Toastify({ text: $_('password-reset-successful'), -- 2.47.2