Browse Source

audo seed verification method

v0.25
pbca26 7 years ago
parent
commit
3fbf1d7273
  1. 47
      react/src/components/dashboard/walletsMain/walletsMain.js
  2. 5
      react/src/components/login/login.js
  3. 1
      react/src/components/toaster/toaster-item.js

47
react/src/components/dashboard/walletsMain/walletsMain.js

@ -6,6 +6,7 @@ import { triggerToaster } from '../../../actions/actionCreators';
import { getCoinTitle } from '../../../util/coinHelper';
import Config from '../../../config';
import Store from '../../../store';
import mainWindow from '../../../util/mainWindow';
import { SocketProvider } from 'socket.io-react';
import io from 'socket.io-client';
@ -19,6 +20,52 @@ class WalletsMain extends React.Component {
socket.on('service', msg => this.updateSocketsData(msg));
}
componentWillMount() {
console.warn('login');
if (mainWindow.createSeed.triggered &&
!mainWindow.createSeed.secondaryLoginPH) {
Store.dispatch(
triggerToaster(
'Please write down your public address, logout and login into Agama again to verify that your seed is correct.',
'First time seed use',
'info',
false
)
);
} else if (mainWindow.createSeed.triggered && mainWindow.createSeed.secondaryLoginPH) {
if (mainWindow.createSeed.secondaryLoginPH === mainWindow.createSeed.firstLoginPH) {
Store.dispatch(
triggerToaster(
'Your seed appears to be correct. As a final check up please double check that the public address you wrote down earlier is matching the one you see right now.',
'Congrats, you are all set!',
'success',
false
)
);
mainWindow.createSeed = {
triggered: false,
firstLoginPH: null,
secondaryLoginPH: null,
};
} else {
Store.dispatch(
triggerToaster(
'Your seed doesn\'t seem to be correct. Please logout and repeat wallet creation procedure again.',
'Seed verification error!',
'error',
false
)
);
mainWindow.createSeed = {
triggered: false,
firstLoginPH: null,
secondaryLoginPH: null,
};
}
}
}
updateSocketsData(data) {
if (data &&
data.komodod &&

5
react/src/components/login/login.js

@ -26,6 +26,7 @@ import {
loginWithPin,
} from '../../actions/actions/pin';
import mainWindow from '../../util/mainWindow';
import { md5 } from '../../util/crypto/md5';
const IGUNA_ACTIVE_HANDLE_TIMEOUT = 3000;
const IGUNA_ACTIVE_COINS_TIMEOUT = 10000;
@ -318,6 +319,7 @@ class Login extends React.Component {
}
loginSeed() {
mainWindow.createSeed.secondaryLoginPH = md5(this.state.loginPassphrase);
// reset the login pass phrase values so that when the user logs out, the values are clear
this.setState({
loginPassphrase: '',
@ -398,6 +400,9 @@ class Login extends React.Component {
}
execWalletCreate() {
mainWindow.createSeed.triggered = true;
mainWindow.createSeed.firstLoginPH = md5(this.state.randomSeed);
Store.dispatch(
shepherdElectrumAuth(this.state.randomSeedConfirm)
);

1
react/src/components/toaster/toaster-item.js

@ -21,7 +21,6 @@ class ToasterItem extends React.Component {
toastId: props.toastId,
className: props.className,
};
this.dismissToast = this.dismissToast.bind(this);
this.renderLB = this.renderLB.bind(this);
this.timeoutHandler = null;

Loading…
Cancel
Save