Quellcode durchsuchen

add reset password confirm method in api

pull/342/head
Guillaume Vincent vor 8 Jahren
Ursprung
Commit
9b299937da
2 geänderte Dateien mit 21 neuen und 0 gelöschten Zeilen
  1. +8
    -0
      src/api/auth.js
  2. +13
    -0
      test/auth.js

+ 8
- 0
src/api/auth.js Datei anzeigen

@@ -77,4 +77,12 @@ export default class Auth {
}
return axios.post('/api/auth/password/reset/', email, config);
}

confirmResetPassword(password, baseURL) {
const config = this.storage.json();
if (baseURL) {
config.baseURL = baseURL;
}
return axios.post('/api/auth/password/reset/confirm/', password, config);
}
}

+ 13
- 0
test/auth.js Datei anzeigen

@@ -117,4 +117,17 @@ test('should reset a password', t => {
const auth = new Auth(storage);
nock('https://lesspass.com').post('/api/auth/password/reset/', {email}).reply(204);
t.notThrows(auth.resetPassword({email}));
});

test('should confirm reset password', t => {
var newPassword ={
uid: 'MQ',
token: '5g1-2bd69bd6f6dcd73f8124',
new_password: 'password1'
};
const localStorage = new LocalStorageMock();
const storage = new Storage(localStorage);
const auth = new Auth(storage);
nock('https://lesspass.com').post('/api/auth/password/reset/confirm/', newPassword).reply(204);
t.notThrows(auth.confirmResetPassword(newPassword));
});

Laden…
Abbrechen
Speichern