mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 12:51:42 +03:00
Merge pull request #1145 from esteemapp/bugfix/authority
Fixed authority issue
This commit is contained in:
commit
d077149998
@ -1,6 +1,7 @@
|
|||||||
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 Config from 'react-native-config';
|
||||||
|
import get from 'lodash/get';
|
||||||
|
|
||||||
import { getUser } from './dsteem';
|
import { getUser } from './dsteem';
|
||||||
import {
|
import {
|
||||||
@ -169,6 +170,16 @@ export const setUserDataWithPinCode = async data => {
|
|||||||
const result = getUserDataWithUsername(data.username);
|
const result = getUserDataWithUsername(data.username);
|
||||||
const userData = result[0];
|
const userData = result[0];
|
||||||
|
|
||||||
|
if (!data.password) {
|
||||||
|
const publicKey =
|
||||||
|
get(userData, 'masterKey') ||
|
||||||
|
get(userData, 'activeKey') ||
|
||||||
|
get(userData, 'memoKey') ||
|
||||||
|
get(userData, 'postingKey');
|
||||||
|
|
||||||
|
data.password = decryptKey(publicKey, data.pinCode);
|
||||||
|
}
|
||||||
|
|
||||||
const updatedUserData = getUpdatedUserData(userData, data);
|
const updatedUserData = getUpdatedUserData(userData, data);
|
||||||
|
|
||||||
await setPinCode(data.pinCode);
|
await setPinCode(data.pinCode);
|
||||||
@ -188,8 +199,19 @@ export const updatePinCode = data =>
|
|||||||
getUserData().then(async users => {
|
getUserData().then(async users => {
|
||||||
if (users && users.length > 0) {
|
if (users && users.length > 0) {
|
||||||
await users.forEach(userData => {
|
await users.forEach(userData => {
|
||||||
if (userData.authType === AUTH_TYPE.MASTER_KEY) {
|
if (
|
||||||
data.password = decryptKey(userData.masterKey, data.oldPinCode);
|
userData.authType === AUTH_TYPE.MASTER_KEY ||
|
||||||
|
userData.authType === AUTH_TYPE.ACTIVE_KEY ||
|
||||||
|
userData.authType === AUTH_TYPE.MEMO_KEY ||
|
||||||
|
userData.authType === AUTH_TYPE.POSTING_KEY
|
||||||
|
) {
|
||||||
|
const publicKey =
|
||||||
|
get(userData, 'masterKey') ||
|
||||||
|
get(userData, 'activeKey') ||
|
||||||
|
get(userData, 'memoKey') ||
|
||||||
|
get(userData, 'postingKey');
|
||||||
|
|
||||||
|
data.password = decryptKey(publicKey, data.oldPinCode);
|
||||||
} else if (userData.authType === AUTH_TYPE.STEEM_CONNECT) {
|
} else if (userData.authType === AUTH_TYPE.STEEM_CONNECT) {
|
||||||
data.accessToken = decryptKey(userData.accessToken, data.oldPinCode);
|
data.accessToken = decryptKey(userData.accessToken, data.oldPinCode);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user