mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-16 00:27:49 +02:00
Fix user preferences not being applied correctly after sign-in
This commit is contained in:
19
resources/js/mixins.js
vendored
19
resources/js/mixins.js
vendored
@ -1,4 +1,5 @@
|
||||
import Vue from 'vue'
|
||||
import i18n from './langs/i18n'
|
||||
|
||||
Vue.mixin({
|
||||
|
||||
@ -100,7 +101,23 @@ Vue.mixin({
|
||||
|
||||
setTheme(theme) {
|
||||
document.documentElement.dataset.theme = theme;
|
||||
}
|
||||
},
|
||||
|
||||
applyPreferences(preferences) {
|
||||
for (const preference in preferences) {
|
||||
try {
|
||||
this.$root.userPreferences[preference] = preferences[preference]
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
if (this.$root.userPreferences.lang != 'browser') {
|
||||
i18n.locale = this.$root.userPreferences.lang
|
||||
document.documentElement.lang = this.$root.userPreferences.lang
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
})
|
@ -72,6 +72,7 @@
|
||||
|
||||
this.form.post('/user/login', {returnError: true})
|
||||
.then(response => {
|
||||
this.applyPreferences(response.data.preferences);
|
||||
this.$router.push({ name: 'accounts', params: { toRefresh: true } })
|
||||
})
|
||||
.catch(error => {
|
||||
@ -131,6 +132,7 @@
|
||||
const publicKeyCredential = this.webauthn.parseOutgoingCredentials(credentials)
|
||||
|
||||
this.axios.post('/webauthn/login', publicKeyCredential, {returnError: true}).then(response => {
|
||||
this.applyPreferences(response.data.preferences);
|
||||
this.$router.push({ name: 'accounts', params: { toRefresh: true } })
|
||||
})
|
||||
.catch(error => {
|
||||
|
Reference in New Issue
Block a user