- added backup codes for 2 factor authentication
Some checks failed
CI Pipeline / japa-tests (push) Failing after 58s

- npm updates
- coverage validation: elevation ust be positive, depth must be negative
- vinejs-provider.js: get enabled extensions from database, not via validOptions.extnames
- vue components for backup codes: e.g.: PersonalSettings.vue
- validate spaital coverage in leaflet map: draw.component.vue, map.component.vue
- add backup code authentication into Login.vue
- preset to use no preferred reviewer: Release.vue
- 2 new vinejs validation rules: file_scan.ts and file-length.ts
This commit is contained in:
Kaimbacher 2024-07-08 13:52:20 +02:00
parent ac473b1e72
commit 005df2e454
32 changed files with 1416 additions and 526 deletions

View file

@ -35,6 +35,14 @@ export const saveState = async (data) => {
return resp.data;
};
export const generateCodes = async () => {
const url = '/api/twofactor_backupcodes/settings/create';
// return Axios.post(url, {}).then((resp) => resp.data);
const resp = await axios.post(url, {});
return resp.data;
};
// Anfrage staet : 1
// ANtwort json:
@ -68,11 +76,16 @@ export const MainService = defineStore('main', {
totpState: 0,
backupcodesEnabled: false,
total: 0,
used: 0,
codes: [],
graphData: {},
}),
actions: {
// payload = authenticated user
setUser(payload) {
setUser(payload: any) {
if (payload.name) {
this.userName = payload.name;
}
@ -84,7 +97,7 @@ export const MainService = defineStore('main', {
}
},
setDataset(payload) {
setDataset(payload: any) {
this.dataset = payload;
// this.dataset = {
@ -109,7 +122,7 @@ export const MainService = defineStore('main', {
this.dataset = null;
},
fetch(sampleDataKey) {
fetch(sampleDataKey: any) {
// sampleDataKey= clients or history
axios
.get(`/data-sources/${sampleDataKey}.json`)
@ -155,8 +168,12 @@ export const MainService = defineStore('main', {
},
async disable() {
const { state } = await saveState({ state: State.STATE_DISABLED });
const { state, backupState } = await saveState({ state: State.STATE_DISABLED });
this.totpState = state;
this.backupcodesEnabled = backupState.enabled;
this.total = backupState.total;
this.used = backupState.used;
},
async confirm(code: string) {
@ -181,6 +198,15 @@ export const MainService = defineStore('main', {
});
},
async generate(): Promise<void> {
const { codes, backupState } = await generateCodes();
// this.totpState = state;
this.codes = codes;
this.backupcodesEnabled = backupState.enabled;
this.total = backupState.total;
this.used = backupState.used;
},
// fetchfiles(id) {
// // sampleDataKey= authors or datasets
// axios