Commit 2a7db854 authored by Emily Jensen's avatar Emily Jensen

Updated change password function

parent f0ee557d
......@@ -32,11 +32,11 @@ export class UserService {
) {}
/*
* Check if username is available
* returns true or false
* if true: RegisterComponent calls register method below
* if false: alert message triggered in RegisterComponent
*/
* Check if username is available
* returns true or false
* if true: RegisterComponent calls register method below
* if false: alert message triggered in RegisterComponent
*/
public checkUsername(
email: string
): Promise<{ isAvailable: boolean; error?: IPassitSDKError }> {
......@@ -106,9 +106,9 @@ export class UserService {
}
/*
* send login get to sdk
* email and password to login user
*/
* send login get to sdk
* email and password to login user
*/
public login(
email: string,
password: string,
......@@ -152,19 +152,8 @@ export class UserService {
/** Change the users password - note this can take some time.
*/
public changePassword(
oldPassword: string,
newPassword: string
): Promise<any> {
return new Promise((resolve, reject) => {
const email$ = this.store.pipe(select(fromAccount.getEmail));
email$.pipe(take(1)).subscribe(email => {
this.sdk
.change_password(oldPassword, newPassword)
.then(() => resolve())
.catch(error => reject(error));
});
});
public changePassword(oldPassword: string, newPassword: string) {
return from(this.sdk.change_password(oldPassword, newPassword));
}
/** Delete User Account forever. */
......@@ -180,9 +169,9 @@ export class UserService {
}
/*
* create user post to sdk
* pass email and password to sdk to register user
*/
* create user post to sdk
* pass email and password to sdk to register user
*/
public register(email: string, password: string, rememberMe: boolean) {
return this.sdk
.sign_up(email, password)
......@@ -383,7 +372,6 @@ export class UserService {
};
return this.http.patch(url, data).pipe(
map(resp => {
console.log("New backup code: " + backupCode);
return backupCode;
})
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment