2020-04-18 01:46:07 +02:00
|
|
|
import AbstractService from './abstractService'
|
2020-09-05 22:35:52 +02:00
|
|
|
import TotpModel from '../models/totp'
|
2020-04-18 01:46:07 +02:00
|
|
|
|
|
|
|
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]))
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|