Working on bugs

This commit is contained in:
Mustafa Buyukcelebi 2019-01-07 14:14:31 +03:00
parent b6114e7d2c
commit 058386fa88
3 changed files with 4 additions and 10 deletions

View File

@ -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'));
}

View File

@ -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) {

View File

@ -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;