From 3d3ccf629a19b4425ffc0e1a97fc90f8cfc4b1a4 Mon Sep 17 00:00:00 2001 From: konrad Date: Sun, 6 Feb 2022 13:17:55 +0000 Subject: [PATCH] feat: add remember me style login (#1339) Co-authored-by: kolaente Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1339 Reviewed-by: Dominik Pschenitschni Co-authored-by: konrad Co-committed-by: konrad --- src/i18n/lang/en.json | 3 ++- src/store/modules/auth.js | 12 ++---------- src/views/user/Login.vue | 8 ++++++++ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json index da4cabf61..585cdfb06 100644 --- a/src/i18n/lang/en.json +++ b/src/i18n/lang/en.json @@ -56,7 +56,8 @@ "showPassword": "Show the password", "hidePassword": "Hide the password", "noAccountYet": "Don't have an account yet?", - "alreadyHaveAnAccount": "Already have an account?" + "alreadyHaveAnAccount": "Already have an account?", + "remember": "Stay logged in" }, "settings": { "title": "Settings", diff --git a/src/store/modules/auth.js b/src/store/modules/auth.js index e71bbe738..9e2f9cbb8 100644 --- a/src/store/modules/auth.js +++ b/src/store/modules/auth.js @@ -1,5 +1,6 @@ import {HTTPFactory} from '@/http-common' import {i18n, getCurrentLanguage, saveLanguage} from '@/i18n' +import {objectToSnakeCase} from '@/helpers/case' import {LOADING} from '../mutation-types' import UserModel from '@/models/user' import UserSettingsService from '@/services/userSettings' @@ -90,17 +91,8 @@ export default { // Delete an eventually preexisting old token removeToken() - const data = { - username: credentials.username, - password: credentials.password, - } - - if (credentials.totpPasscode) { - data.totp_passcode = credentials.totpPasscode - } - try { - const response = await HTTP.post('login', data) + const response = await HTTP.post('login', objectToSnakeCase(credentials)) // Save the token to local storage for later use saveToken(response.data.token, true) diff --git a/src/views/user/Login.vue b/src/views/user/Login.vue index b6e5be039..c00110476 100644 --- a/src/views/user/Login.vue +++ b/src/views/user/Login.vue @@ -58,6 +58,12 @@ /> +
+ +