From f8fe580e1665c319deaa0a0cbdae8bac2702931d Mon Sep 17 00:00:00 2001 From: Maxim Filippov Date: Fri, 13 Sep 2019 01:55:50 +0300 Subject: [PATCH] Login via PleromaFE --- package.json | 1 + src/lang/en.js | 9 ++++--- src/store/modules/user.js | 8 +++++++ src/views/login/index.vue | 50 +++++++++++++++++++++++++++++++++++++-- yarn.lock | 9 ++++++- 5 files changed, 71 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index fac6ba8e..0327b45b 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "js-cookie": "2.2.0", "jsonlint": "1.6.3", "jszip": "3.1.5", + "localforage": "^1.7.3", "lodash": "^4.17.11", "lodash.debounce": "^4.0.8", "moment": "^2.24.0", diff --git a/src/lang/en.js b/src/lang/en.js index 94e64662..e21edbce 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -78,12 +78,15 @@ export default { login: { title: 'Login Form', logIn: 'Log in', - username: 'Username@Host', - password: 'Password', + logInViaPleromaFE: 'Log in via PleromaFE', + username: 'username@host', + password: 'password', + omitHostname: 'omit hostname if Pleroma is located on this domain', errorMessage: 'Username must contain username and host, e.g. john@pleroma.social', any: 'any', thirdparty: 'Or connect with', - thirdpartyTips: 'Can not be simulated on local, so please combine you own business simulation! ! !' + pleromaFELoginFailed: 'Failed to login via PleromaFE, please login with username/password', + pleromaFELoginSucceed: 'Logged in via PleromaFE' }, documentation: { documentation: 'Documentation', diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 2a81fcb4..18ff5419 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -106,6 +106,14 @@ const user = { removeAuthHost() resolve() }) + }, + async LoginByPleromaFE({ commit, dispatch }, { token }) { + commit('SET_TOKEN', token) + setToken(token) + commit('SET_AUTH_HOST', window.location.host) + setAuthHost(window.location.host) + + dispatch('GetUserInfo') } } } diff --git a/src/views/login/index.vue b/src/views/login/index.vue index da396aea..fdb00fe2 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -19,6 +19,7 @@ auto-complete="on" /> +
{{ $t('login.omitHostname') }}
@@ -37,15 +38,21 @@ - + +