Fixed login issue without pin

This commit is contained in:
Mustafa Buyukcelebi 2019-08-13 10:46:51 +03:00
parent 682920c5b4
commit 0d674d97af
2 changed files with 14 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import * as dsteem from 'dsteem'; import * as dsteem from 'dsteem';
import sha256 from 'crypto-js/sha256'; import sha256 from 'crypto-js/sha256';
import Config from 'react-native-config';
import { getUser } from './dsteem'; import { getUser } from './dsteem';
import { import {
@ -21,7 +22,7 @@ import { getSCAccessToken } from '../esteem/esteem';
// Constants // Constants
import AUTH_TYPE from '../../constants/authType'; import AUTH_TYPE from '../../constants/authType';
export const login = async (username, password) => { export const login = async (username, password, isPinCodeOpen) => {
let loginFlag = false; let loginFlag = false;
let avatar = ''; let avatar = '';
let authType = ''; let authType = '';
@ -74,7 +75,17 @@ export const login = async (username, password) => {
accessToken: '', accessToken: '',
}; };
account.local = userData; if (isPinCodeOpen) {
account.local = userData;
} else {
const resData = {
pinCode: Config.DEFAULT_PIN,
password,
};
const updatedUserData = await getUpdatedUserData(userData, resData);
account.local = updatedUserData;
}
const authData = { const authData = {
isLoggedIn: true, isLoggedIn: true,

View File

@ -51,7 +51,7 @@ class LoginContainer extends PureComponent {
this.setState({ isLoading: true }); this.setState({ isLoading: true });
login(username, password) login(username, password, isPinCodeOpen)
.then(result => { .then(result => {
if (result) { if (result) {
dispatch(updateCurrentAccount({ ...result })); dispatch(updateCurrentAccount({ ...result }));