Fixed pin code issue

This commit is contained in:
Mustafa Buyukcelebi 2018-12-21 17:08:41 +03:00
parent 2e189ca2b9
commit 2807d669f0

View File

@ -138,19 +138,16 @@ export const setUserDataWithPinCode = async (data) => {
memoKey: encryptKey(privateKeys.memo.toString(), data.pinCode), memoKey: encryptKey(privateKeys.memo.toString(), data.pinCode),
}; };
updateUserData(updatedUserData) const response = await updateUserData(updatedUserData);
.then(async (response) => { const authData = {
const authData = { isLoggedIn: true,
isLoggedIn: true, currentUsername: userData.username,
currentUsername: userData.username, };
};
await setAuthStatus(authData); await setAuthStatus(authData);
const encriptedPinCode = encryptKey(data.pinCode, 'pin-code'); const encriptedPinCode = encryptKey(data.pinCode, 'pin-code');
await setPinCode(encriptedPinCode); await setPinCode(encriptedPinCode);
return (response); return (response);
})
.catch(err => (err));
}; };
export const updatePinCode = async (data) => { export const updatePinCode = async (data) => {
@ -189,7 +186,6 @@ export const verifyPinCode = async (data) => {
const userData = result[0]; const userData = result[0];
let account = null; let account = null;
let loginFlag = false; let loginFlag = false;
console.log('result :', result);
if (result.length > 0) { if (result.length > 0) {
if (userData.masterKey || userData.accessToken) { if (userData.masterKey || userData.accessToken) {
if (userData.authType === 'steemConnect') { if (userData.authType === 'steemConnect') {
@ -220,7 +216,6 @@ export const verifyPinCode = async (data) => {
} }
}); });
} }
console.log('lofinFlag1 :', loginFlag);
} else { } else {
const encriptedPinCode = await getPinCode(); const encriptedPinCode = await getPinCode();
const pinCode = decryptKey(encriptedPinCode, 'pin-code'); const pinCode = decryptKey(encriptedPinCode, 'pin-code');
@ -230,7 +225,6 @@ export const verifyPinCode = async (data) => {
loginFlag = true; loginFlag = true;
} }
} }
console.log('loginFlag2 :', loginFlag);
} }
} }
if (loginFlag) { if (loginFlag) {
@ -246,10 +240,8 @@ export const verifyPinCode = async (data) => {
memoKey: decryptKey(userData.memoKey, data.pinCode), memoKey: decryptKey(userData.memoKey, data.pinCode),
}; };
await setAuthStatus(authData); await setAuthStatus(authData);
console.log('response :', response);
return (response); return (response);
} }
console.log('test :');
return Promise.reject(new Error('Invalid pin code, please check and try again')); return Promise.reject(new Error('Invalid pin code, please check and try again'));
}; };