Fixed #883. Fixed pin code crash issue

This commit is contained in:
Mustafa Buyukcelebi 2019-11-20 17:52:55 +03:00
parent e96ffb2ccb
commit 643c4ce08e
2 changed files with 42 additions and 31 deletions

View File

@ -245,39 +245,50 @@ class PinCodeContainer extends Component {
const { intl, currentAccount, applicationPinCode } = this.props;
const { isExistUser, pinCode } = this.state;
const realmData = await getUserDataWithUsername(currentAccount.name);
const userData = realmData[0];
try {
const realmData = await getUserDataWithUsername(currentAccount.name);
const userData = realmData[0];
// For exist users
if (isReset) {
await this._resetPinCode(pin);
return true;
}
if (isExistUser) {
if (!userData.accessToken && !userData.masterKey && applicationPinCode) {
const verifiedPin = decryptKey(applicationPinCode, Config.PIN_KEY);
if (verifiedPin === pin) {
await this._setFirstPinCode(pin);
} else {
Alert.alert(
intl.formatMessage({
id: 'alert.warning',
}),
intl.formatMessage({
id: 'alert.invalid_pincode',
}),
);
}
} else {
await this._verifyPinCode(pin);
// For exist users
if (isReset) {
await this._resetPinCode(pin);
return true;
}
if (isExistUser) {
if (!userData.accessToken && !userData.masterKey && applicationPinCode) {
const verifiedPin = decryptKey(applicationPinCode, Config.PIN_KEY);
if (verifiedPin === pin) {
await this._setFirstPinCode(pin);
} else {
Alert.alert(
intl.formatMessage({
id: 'alert.warning',
}),
intl.formatMessage({
id: 'alert.invalid_pincode',
}),
);
}
} else {
await this._verifyPinCode(pin);
}
return true;
}
return true;
}
// For new users
if (pinCode === pin) {
await this._setFirstPinCode(pin);
return true;
// For new users
if (pinCode === pin) {
await this._setFirstPinCode(pin);
return true;
}
} catch (error) {
Alert.alert(
intl.formatMessage({
id: 'alert.warning',
}),
intl.formatMessage({
id: error.message,
}),
);
}
if (!pinCode) {

View File

@ -158,7 +158,7 @@ export const groomingWalletData = async (user, globalProps) => {
walletData.showPowerDown = user.next_vesting_withdrawal !== '1969-12-31T23:59:59';
const timeDiff = Math.abs(parseDate(user.next_vesting_withdrawal) - new Date());
walletData.nextVestingWithdrawal = Math.ceil(timeDiff / (1000 * 3600 * 24));
walletData.nextVestingWithdrawal = Math.floor(timeDiff / (1000 * 3600 * 24));
const { transfer_history: transferHistory } = get(accounts, user.name, []);
walletData.transactions = transferHistory