diff --git a/src/providers/steem/auth.js b/src/providers/steem/auth.js index c3dd2ad11..592e2c284 100644 --- a/src/providers/steem/auth.js +++ b/src/providers/steem/auth.js @@ -137,7 +137,6 @@ export const setUserDataWithPinCode = async (data) => { const userData = result[0]; const privateKeys = getPrivateKeys(userData.username, data.password); - const updatedUserData = { username: userData.username, authType: userData.authType, @@ -193,11 +192,9 @@ export const updatePinCode = async (data) => { }; export const verifyPinCode = async (data) => { - const pinHash = getPinCode(); + const pinHash = await getPinCode(); - // CHECK PIN HASH with console log - - if (sha256(data.pinCode) !== pinHash) { + if (sha256(data.pinCode).toString() !== pinHash) { return Promise.reject(new Error('Invalid pin code, please check and try again')); } diff --git a/src/realm/realm.js b/src/realm/realm.js index 45189b23f..cc480f33c 100644 --- a/src/realm/realm.js +++ b/src/realm/realm.js @@ -298,7 +298,7 @@ export const setPinCode = pinCode => new Promise((resolve, reject) => { const pinHash = sha256(pinCode); realm.write(() => { - auth[0].pinCode = pinHash; + auth[0].pinCode = pinHash.toString(); resolve(auth[0]); }); } catch (error) { diff --git a/src/screens/pinCode/container/pinCodeContainer.js b/src/screens/pinCode/container/pinCodeContainer.js index fb0a40eb9..e9c761e7b 100644 --- a/src/screens/pinCode/container/pinCodeContainer.js +++ b/src/screens/pinCode/container/pinCodeContainer.js @@ -161,7 +161,6 @@ class PinCodeContainer extends Component { accessToken, navigateTo, navigation, - setWrappedComponentState, } = this.props; // If the user is exist, we are just checking to pin and navigating to home screen @@ -172,10 +171,8 @@ class PinCodeContainer extends Component { accessToken, }; verifyPinCode(pinData) - .then((res) => { - setWrappedComponentState(res); + .then(() => { this._savePinCode(pin); - const realmData = getUserDataWithUsername(currentAccount.name); const _currentAccount = currentAccount; _currentAccount.username = _currentAccount.name;