konrad
99c10d49be
All checks were successful
continuous-integration/drone/push Build is passing
Fix not telling the user about invalid totp passcodes when logging in Add disabling totp authentication Add totp passcode when logging in Add totp settings Add general post method function Co-authored-by: kolaente <k@knt.li> Reviewed-on: #109
38 lines
724 B
JavaScript
38 lines
724 B
JavaScript
import AbstractService from './abstractService'
|
|
import TotpModel from "../models/totp";
|
|
|
|
export default class TotpService extends AbstractService {
|
|
urlPrefix = '/user/settings/totp'
|
|
|
|
constructor() {
|
|
super({})
|
|
|
|
this.paths.get = this.urlPrefix
|
|
}
|
|
|
|
modelFactory(data) {
|
|
return new TotpModel(data)
|
|
}
|
|
|
|
enroll() {
|
|
return this.post(`${this.urlPrefix}/enroll`, {})
|
|
}
|
|
|
|
enable(model) {
|
|
return this.post(`${this.urlPrefix}/enable`, model)
|
|
}
|
|
|
|
disable(model) {
|
|
return this.post(`${this.urlPrefix}/disable`, model)
|
|
}
|
|
|
|
qrcode() {
|
|
return this.http({
|
|
url: `${this.urlPrefix}/qrcode`,
|
|
method: 'GET',
|
|
responseType: 'blob',
|
|
}).then(response => {
|
|
return Promise.resolve(new Blob([response.data]))
|
|
})
|
|
}
|
|
} |