- added api UserController.ts for 2FA
Some checks failed
CI Pipeline / japa-tests (push) Failing after 56s
Some checks failed
CI Pipeline / japa-tests (push) Failing after 56s
- added PersonalTotpSettings.vue vor enablin/disabling 2FA - changed User.ts: added attributes: state, twoFactorSecret and twoFactorRecoveryCodes - added resources/js/utils/toast.ts for notifications - modified start/routes/api.ts - npm updates
This commit is contained in:
parent
18635f77b3
commit
ebc62d9117
18 changed files with 1151 additions and 315 deletions
|
@ -22,6 +22,26 @@ interface TransactionItem {
|
|||
business: string;
|
||||
}
|
||||
|
||||
export enum State {
|
||||
STATE_DISABLED = 0,
|
||||
STATE_CREATED = 1,
|
||||
STATE_ENABLED = 2,
|
||||
}
|
||||
|
||||
export const saveState = async (data) => {
|
||||
const url = '/api/twofactor_totp/settings/enable';
|
||||
|
||||
const resp = await axios.post(url, data);
|
||||
return resp.data;
|
||||
};
|
||||
|
||||
// Anfrage staet : 1
|
||||
|
||||
// ANtwort json:
|
||||
// state: 1
|
||||
// secret:"OX7IQ4OI3GXGFPHY"
|
||||
// qUrl:"https://odysseus.geologie.ac.at/apps/twofactor_totp/settings/enable"
|
||||
|
||||
export const MainService = defineStore('main', {
|
||||
state: () => ({
|
||||
/* User */
|
||||
|
@ -40,11 +60,13 @@ export const MainService = defineStore('main', {
|
|||
authors: [] as Array<Person>,
|
||||
// persons: [] as Array<Person>,
|
||||
datasets: [],
|
||||
files:[],
|
||||
files: [],
|
||||
|
||||
dataset: {} as Dataset,
|
||||
|
||||
menu: menu,
|
||||
|
||||
totpState: 0,
|
||||
}),
|
||||
actions: {
|
||||
// payload = authenticated user
|
||||
|
@ -113,6 +135,36 @@ export const MainService = defineStore('main', {
|
|||
});
|
||||
},
|
||||
|
||||
setState(state) {
|
||||
this.totpState = state;
|
||||
},
|
||||
|
||||
async create(): Promise<{ url: any; secret: any; svg: any }> {
|
||||
const { state, secret, url, svg } = await saveState({ state: State.STATE_CREATED });
|
||||
this.totpState = state;
|
||||
return { url, secret, svg };
|
||||
// .then(({ state, secret, qrUrl }) => {
|
||||
// this.totpState = state;
|
||||
// return { qrUrl, secret };
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// alert(error.message);
|
||||
// });
|
||||
},
|
||||
|
||||
async disable() {
|
||||
const { state } = await saveState({ state: State.STATE_DISABLED });
|
||||
this.totpState = state;
|
||||
},
|
||||
|
||||
async confirm(code: string) {
|
||||
const { state } = await saveState({
|
||||
state: State.STATE_ENABLED,
|
||||
code,
|
||||
});
|
||||
this.totpState = state;
|
||||
},
|
||||
|
||||
// fetchfiles(id) {
|
||||
// // sampleDataKey= authors or datasets
|
||||
// axios
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue