2017-08-02 01:30:02 +05:30
|
|
|
// @flow
|
|
|
|
import request from 'services/request';
|
|
|
|
import type { Resp } from 'services/request';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
getSecret(): Promise<Resp<{qr: string, secret: string, uri: string}>> {
|
|
|
|
return request.get('/api/two-factor-auth');
|
2017-08-20 21:15:21 +05:30
|
|
|
},
|
|
|
|
|
|
|
|
enable(data: {totp: string, password?: string}): Promise<Resp<*>> {
|
|
|
|
return request.post('/api/two-factor-auth', {
|
2017-09-09 19:52:19 +05:30
|
|
|
totp: data.totp,
|
2017-08-20 21:15:21 +05:30
|
|
|
password: data.password || ''
|
2017-09-09 19:52:19 +05:30
|
|
|
});
|
|
|
|
},
|
2017-08-20 21:15:21 +05:30
|
|
|
|
2017-09-09 19:52:19 +05:30
|
|
|
disable(data: {totp: string, password?: string}): Promise<Resp<*>> {
|
|
|
|
return request.delete('/api/two-factor-auth', {
|
|
|
|
totp: data.totp,
|
|
|
|
password: data.password || ''
|
2017-08-20 21:15:21 +05:30
|
|
|
});
|
2017-08-02 01:30:02 +05:30
|
|
|
}
|
|
|
|
};
|