diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2021-07-22 13:21:25 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2021-07-22 13:21:25 +0200 |
commit | 7ca81f360f42341b2941798374160d362507ba26 (patch) | |
tree | a3d4701504898e6c864980b989b78fc88ed92fbd /core/src | |
parent | 49b490ce6d1d726aa1c335b0b5c440d8a3cae5ff (diff) | |
download | nextcloud-server-7ca81f360f42341b2941798374160d362507ba26.tar.gz nextcloud-server-7ca81f360f42341b2941798374160d362507ba26.zip |
Fix eslint and update bundles
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/globals.js | 2 | ||||
-rw-r--r-- | core/src/login.js | 44 | ||||
-rw-r--r-- | core/src/tests/.eslintrc.js | 4 | ||||
-rw-r--r-- | core/src/views/Login.vue | 102 |
4 files changed, 40 insertions, 112 deletions
diff --git a/core/src/globals.js b/core/src/globals.js index 7c5ccd77e25..44dcae66e70 100644 --- a/core/src/globals.js +++ b/core/src/globals.js @@ -83,7 +83,7 @@ const deprecate = (func, funcName, version) => { } const setDeprecatedProp = (global, cb, msg) => { - (Array.isArray(global) ? global : [global]).map(global => { + (Array.isArray(global) ? global : [global]).forEach(global => { if (window[global] !== undefined) { delete window[global] } diff --git a/core/src/login.js b/core/src/login.js index 9a2507e4798..13f6bfb86c9 100644 --- a/core/src/login.js +++ b/core/src/login.js @@ -23,8 +23,6 @@ * */ -import { loadState } from '@nextcloud/initial-state' -import queryString from 'query-string' import Vue from 'vue' // eslint-disable-next-line no-unused-vars @@ -32,47 +30,7 @@ import OC from './OC/index' // TODO: Not needed but L10n breaks if removed import LoginView from './views/Login.vue' import Nextcloud from './mixins/Nextcloud' -const query = queryString.parse(location.search) -if (query.clear === '1') { - try { - window.localStorage.clear() - window.sessionStorage.clear() - console.debug('Browser storage cleared') - } catch (e) { - console.error('Could not clear browser storage', e) - } -} - Vue.mixin(Nextcloud) -const fromStateOr = (key, orValue) => { - try { - return loadState('core', key) - } catch (e) { - return orValue - } -} - const View = Vue.extend(LoginView) -new View({ - propsData: { - errors: fromStateOr('loginErrors', []), - messages: fromStateOr('loginMessages', []), - redirectUrl: fromStateOr('loginRedirectUrl', undefined), - username: fromStateOr('loginUsername', ''), - throttleDelay: fromStateOr('loginThrottleDelay', 0), - invertedColors: OCA.Theming && OCA.Theming.inverted, - canResetPassword: fromStateOr('loginCanResetPassword', false), - resetPasswordLink: fromStateOr('loginResetPasswordLink', ''), - autoCompleteAllowed: fromStateOr('loginAutocomplete', true), - resetPasswordTarget: fromStateOr('resetPasswordTarget', ''), - resetPasswordUser: fromStateOr('resetPasswordUser', ''), - directLogin: query.direct === '1', - hasPasswordless: fromStateOr('webauthn-available', false), - countAlternativeLogins: fromStateOr('countAlternativeLogins', false), - isHttps: window.location.protocol === 'https:', - isLocalhost: window.location.hostname === 'localhost', - hasPublicKeyCredential: typeof (window.PublicKeyCredential) !== 'undefined', - hideLoginForm: fromStateOr('hideLoginForm', false), - }, -}).$mount('#login') +new View().$mount('#login') diff --git a/core/src/tests/.eslintrc.js b/core/src/tests/.eslintrc.js index 449d15fec67..1559824cbcd 100644 --- a/core/src/tests/.eslintrc.js +++ b/core/src/tests/.eslintrc.js @@ -26,6 +26,6 @@ module.exports = { sinon: true, }, rules: { - "node/no-unpublished-import": 'off' - } + 'node/no-unpublished-import': 'off', + }, } diff --git a/core/src/views/Login.vue b/core/src/views/Login.vue index 1372f40b112..f7a96514afe 100644 --- a/core/src/views/Login.vue +++ b/core/src/views/Login.vue @@ -111,91 +111,61 @@ </template> <script> +import { loadState } from '@nextcloud/initial-state' +import queryString from 'query-string' + import LoginForm from '../components/login/LoginForm.vue' import PasswordLessLoginForm from '../components/login/PasswordLessLoginForm.vue' import ResetPassword from '../components/login/ResetPassword.vue' import UpdatePassword from '../components/login/UpdatePassword.vue' +const query = queryString.parse(location.search) +if (query.clear === '1') { + try { + window.localStorage.clear() + window.sessionStorage.clear() + console.debug('Browser storage cleared') + } catch (e) { + console.error('Could not clear browser storage', e) + } +} + export default { name: 'Login', + components: { LoginForm, PasswordLessLoginForm, ResetPassword, UpdatePassword, }, - props: { - username: { - type: String, - default: '', - }, - redirectUrl: { - type: String, - }, - errors: { - type: Array, - default: () => [], - }, - messages: { - type: Array, - default: () => [], - }, - throttleDelay: { - type: Number, - }, - canResetPassword: { - type: Boolean, - default: false, - }, - resetPasswordLink: { - type: String, - }, - resetPasswordTarget: { - type: String, - }, - invertedColors: { - type: Boolean, - default: false, - }, - autoCompleteAllowed: { - type: Boolean, - default: true, - }, - directLogin: { - type: Boolean, - default: false, - }, - hasPasswordless: { - type: Boolean, - default: false, - }, - countAlternativeLogins: { - type: Number, - default: 0, - }, - isHttps: { - type: Boolean, - default: false, - }, - isLocalhost: { - type: Boolean, - default: false, - }, - hasPublicKeyCredential: { - type: Boolean, - default: false, - }, - hideLoginForm: { - type: Boolean, - default: false, - }, - }, + data() { return { loading: false, user: this.username, passwordlessLogin: false, resetPassword: false, + + // Initial data + errors: loadState('core', 'loginErrors', []), + messages: loadState('core', 'loginMessages', []), + redirectUrl: loadState('core', 'loginRedirectUrl', undefined), + username: loadState('core', 'loginUsername', ''), + throttleDelay: loadState('core', 'loginThrottleDelay', 0), + invertedColors: OCA.Theming && OCA.Theming.inverted, + canResetPassword: loadState('core', 'loginCanResetPassword', false), + resetPasswordLink: loadState('core', 'loginResetPasswordLink', ''), + autoCompleteAllowed: loadState('core', 'loginAutocomplete', true), + resetPasswordTarget: loadState('core', 'resetPasswordTarget', ''), + resetPasswordUser: loadState('core', 'resetPasswordUser', ''), + directLogin: query.direct === '1', + hasPasswordless: loadState('core', 'webauthn-available', false), + countAlternativeLogins: loadState('core', 'countAlternativeLogins', false), + isHttps: window.location.protocol === 'https:', + isLocalhost: window.location.hostname === 'localhost', + hasPublicKeyCredential: typeof (window.PublicKeyCredential) !== 'undefined', + hideLoginForm: loadState('core', 'hideLoginForm', false), } }, methods: { |