feat: Login script setup (#2417)
Co-authored-by: Dominik Pschenitschni <mail@celement.de> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/2417 Reviewed-by: konrad <k@knt.li> Co-authored-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de> Co-committed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
This commit is contained in:

committed by
konrad

parent
940063784b
commit
63fb8a1962
@ -275,6 +275,27 @@ export const useAuthStore = defineStore('auth', {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Try to verify the email
|
||||
* @returns {Promise<boolean>} if the email was successfully confirmed
|
||||
*/
|
||||
async verifyEmail() {
|
||||
const emailVerifyToken = localStorage.getItem('emailConfirmToken')
|
||||
if (emailVerifyToken) {
|
||||
const stopLoading = setModuleLoading(this)
|
||||
try {
|
||||
await HTTPFactory().post('user/confirm', {token: emailVerifyToken})
|
||||
localStorage.removeItem('emailConfirmToken')
|
||||
return true
|
||||
} catch(e) {
|
||||
throw new Error(e.response.data.message)
|
||||
} finally {
|
||||
stopLoading()
|
||||
}
|
||||
}
|
||||
return false
|
||||
},
|
||||
|
||||
async saveUserSettings({
|
||||
settings,
|
||||
showMessage = true,
|
||||
|
@ -132,7 +132,7 @@ export const useBaseStore = defineStore('base', {
|
||||
|
||||
async loadApp() {
|
||||
await checkAndSetApiUrl(window.API_URL)
|
||||
await useAuthStore().checkAuth()
|
||||
useAuthStore().checkAuth()
|
||||
},
|
||||
},
|
||||
})
|
||||
|
@ -4,6 +4,8 @@ import {parseURL} from 'ufo'
|
||||
import {HTTPFactory} from '@/http-common'
|
||||
import {objectToCamelCase} from '@/helpers/case'
|
||||
|
||||
import type {IProvider} from '@/types/IProvider'
|
||||
|
||||
export interface ConfigState {
|
||||
version: string,
|
||||
frontendUrl: string,
|
||||
@ -29,7 +31,7 @@ export interface ConfigState {
|
||||
openidConnect: {
|
||||
enabled: boolean,
|
||||
redirectUrl: string,
|
||||
providers: [],
|
||||
providers: IProvider[],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user