mirror of
https://github.com/ecency/ecency-mobile.git
synced 2025-01-05 04:28:03 +03:00
Working on bugs
This commit is contained in:
parent
413dc5a05e
commit
e545d603cd
@ -137,7 +137,6 @@ export const setUserDataWithPinCode = async (data) => {
|
|||||||
const userData = result[0];
|
const userData = result[0];
|
||||||
|
|
||||||
const privateKeys = getPrivateKeys(userData.username, data.password);
|
const privateKeys = getPrivateKeys(userData.username, data.password);
|
||||||
|
|
||||||
const updatedUserData = {
|
const updatedUserData = {
|
||||||
username: userData.username,
|
username: userData.username,
|
||||||
authType: userData.authType,
|
authType: userData.authType,
|
||||||
@ -193,11 +192,9 @@ export const updatePinCode = async (data) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const verifyPinCode = async (data) => {
|
export const verifyPinCode = async (data) => {
|
||||||
const pinHash = getPinCode();
|
const pinHash = await getPinCode();
|
||||||
|
|
||||||
// CHECK PIN HASH with console log
|
if (sha256(data.pinCode).toString() !== pinHash) {
|
||||||
|
|
||||||
if (sha256(data.pinCode) !== pinHash) {
|
|
||||||
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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ export const setPinCode = pinCode => new Promise((resolve, reject) => {
|
|||||||
const pinHash = sha256(pinCode);
|
const pinHash = sha256(pinCode);
|
||||||
|
|
||||||
realm.write(() => {
|
realm.write(() => {
|
||||||
auth[0].pinCode = pinHash;
|
auth[0].pinCode = pinHash.toString();
|
||||||
resolve(auth[0]);
|
resolve(auth[0]);
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -161,7 +161,6 @@ class PinCodeContainer extends Component {
|
|||||||
accessToken,
|
accessToken,
|
||||||
navigateTo,
|
navigateTo,
|
||||||
navigation,
|
navigation,
|
||||||
setWrappedComponentState,
|
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
// If the user is exist, we are just checking to pin and navigating to home screen
|
// 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,
|
accessToken,
|
||||||
};
|
};
|
||||||
verifyPinCode(pinData)
|
verifyPinCode(pinData)
|
||||||
.then((res) => {
|
.then(() => {
|
||||||
setWrappedComponentState(res);
|
|
||||||
this._savePinCode(pin);
|
this._savePinCode(pin);
|
||||||
|
|
||||||
const realmData = getUserDataWithUsername(currentAccount.name);
|
const realmData = getUserDataWithUsername(currentAccount.name);
|
||||||
const _currentAccount = currentAccount;
|
const _currentAccount = currentAccount;
|
||||||
_currentAccount.username = _currentAccount.name;
|
_currentAccount.username = _currentAccount.name;
|
||||||
|
Loading…
Reference in New Issue
Block a user