Browse Source

pin visual improvements

all-modes^2
petitPapillon 7 years ago
parent
commit
5f8e42a742
  1. 31
      react/src/components/login/login.js
  2. 47
      react/src/components/login/login.render.js
  3. 3
      react/src/translate/en.js

31
react/src/components/login/login.js

@ -45,8 +45,9 @@ class Login extends React.Component {
trimPassphraseTimer: null, trimPassphraseTimer: null,
displayLoginSettingsDropdown: false, displayLoginSettingsDropdown: false,
displayLoginSettingsDropdownSection: null, displayLoginSettingsDropdownSection: null,
shouldEncryptPassword: false, shouldEncryptSeed: false,
encryptKey: '', encryptKey: '',
pubKey: '',
decryptKey: '', decryptKey: '',
selectedPin: '' selectedPin: ''
}; };
@ -63,6 +64,7 @@ class Login extends React.Component {
this.resizeLoginTextarea = this.resizeLoginTextarea.bind(this); this.resizeLoginTextarea = this.resizeLoginTextarea.bind(this);
this.toggleLoginSettingsDropdown = this.toggleLoginSettingsDropdown.bind(this); this.toggleLoginSettingsDropdown = this.toggleLoginSettingsDropdown.bind(this);
this.updateEncryptKey = this.updateEncryptKey.bind(this); this.updateEncryptKey = this.updateEncryptKey.bind(this);
this.updatePubKey = this.updatePubKey.bind(this);
this.updateDecryptKey = this.updateDecryptKey.bind(this); this.updateDecryptKey = this.updateDecryptKey.bind(this);
this.loadPinList = this.loadPinList.bind(this); this.loadPinList = this.loadPinList.bind(this);
} }
@ -104,13 +106,13 @@ class Login extends React.Component {
}); });
} }
shouldEncryptPassword() { shouldEncryptSeed() {
return this.state.shouldEncryptPassword; return this.state.shouldEncryptSeed;
} }
toggleShouldEncryptPassword() { toggleShouldEncryptSeed() {
this.setState({ this.setState({
shouldEncryptPassword: !this.state.shouldEncryptPassword shouldEncryptSeed: !this.state.shouldEncryptSeed
}); });
} }
@ -120,6 +122,13 @@ class Login extends React.Component {
}); });
} }
updatePubKey(e) {
this.setState({
pubKey: e.target.value
});
}
updateDecryptKey(e) { updateDecryptKey(e) {
this.setState({ this.setState({
decryptKey: e.target.value decryptKey: e.target.value
@ -173,6 +182,9 @@ class Login extends React.Component {
} }
componentWillReceiveProps(props) { componentWillReceiveProps(props) {
if (props.login.pinList === "no pins") {
props.login.pinList = [];
}
if (props && if (props &&
props.Main && props.Main &&
props.Main.isLoggedIn) { props.Main.isLoggedIn) {
@ -275,15 +287,12 @@ class Login extends React.Component {
loginPassPhraseSeedType: null, loginPassPhraseSeedType: null,
}); });
console.log('LOGIN SEED', this.state.shouldEncryptPassword, this.state.encryptKey); if (this.state.shouldEncryptSeed) {
Store.dispatch(encryptPassphrase(this.state.loginPassphrase, this.state.encryptKey, this.state.pubKey));
if (this.state.shouldEncryptPassword) {
Store.dispatch(encryptPassphrase(this.state.loginPassphrase, this.state.encryptKey, 'blabla'));
} }
console.log('selected pin', this.state.selectedPin);
if (this.state.selectedPin) { if (this.state.selectedPin) {
Store.dispatch(loginWithPin(this.state.decryptKey, 'blabla')); Store.dispatch(loginWithPin(this.state.decryptKey, this.state.selectedPin));
} else { } else {
Store.dispatch( Store.dispatch(
iguanaWalletPassphrase(this.state.loginPassphrase) iguanaWalletPassphrase(this.state.loginPassphrase)

47
react/src/components/login/login.render.js

@ -89,44 +89,67 @@ const LoginRender = function () {
{ this.state.loginPassphrase && { this.state.loginPassphrase &&
<div className="row"> <div className="row">
<div className="toggle-box vertical-padding-20 col-sm-3"> <div className="toggle-box padding-top-30 col-sm-3">
<span className="pointer"> <span className="pointer">
<label className="switch"> <label className="switch">
<input <input
type="checkbox" type="checkbox"
checked={ this.shouldEncryptPassword() } /> checked={ this.shouldEncryptSeed() } />
<div <div
className="slider" className="slider"
onClick={ () => this.toggleShouldEncryptPassword() }></div> onClick={ () => this.toggleShouldEncryptSeed() }></div>
</label> </label>
<div <div
className="toggle-label white" className="toggle-label white"
onClick={ () => this.toggleShouldEncryptPassword() }> onClick={ () => this.toggleShouldEncryptSeed() }>
{ translate('LOGIN.ENCRYPT_PASSWORD') } { translate('LOGIN.ENCRYPT_SEED') }
</div> </div>
</span> </span>
</div> </div>
<div className="form-group form-material floating col-sm-8 horizontal-padding-0"> <div className="col-sm-9">
<div className="form-group form-material floating horizontal-padding-0 margin-5 margin-right-0">
<input <input
type="text" type="text"
className="form-control" className="form-control"
name="encryptKey" name="encryptKey"
placeholder={ translate('LOGIN.ENCRYPT_KEY') } placeholder={ translate('LOGIN.ENCRYPT_KEY') }
disabled={ !this.shouldEncryptPassword() }
onChange={ this.updateEncryptKey } onChange={ this.updateEncryptKey }
value={ this.state.encryptKey } /> value={ this.state.encryptKey }
disabled={ !this.shouldEncryptSeed() } />
</div>
<div className="form-group form-material floating horizontal-padding-0 margin-5 margin-right">
<input
type="text"
className="form-control"
name="pubKey"
placeholder={ translate('LOGIN.PUBKEY') }
onChange={ this.updatePubKey }
value={ this.state.pubKey }
disabled={ !this.shouldEncryptSeed() } />
</div>
</div> </div>
</div> </div>
} }
<hr /> { this.props.login.pinList.length > 0 &&
<div className="row margin-top-30">
<div className="col-xs-12">
<div style={{width: "10%", float: "left", marginLeft: "38%"}}>
<hr/>
</div>
<div style={{width: "4%", float: "left", marginTop: "10px"}}><span>OR</span></div>
<div style={{width: "10%", float: "left"}}>
<hr/>
</div>
</div>
</div>
}
{ this.props.login.pinList.length > 0 && { this.props.login.pinList.length > 0 &&
<div className="row"> <div className="row">
<div className="form-group form-material floating col-sm-8 padding-left-10 horizontal-padding-0"> <div className="form-group form-material floating col-sm-8 padding-left-10 horizontal-padding-0">
<select <select
placeholder="Pls"
className="form-control form-material" className="form-control form-material"
name="storedPins" name="storedPins"
value={ this.state.selectedPin } value={ this.state.selectedPin }
@ -153,7 +176,7 @@ const LoginRender = function () {
<button <button
type="button" type="button"
className="btn btn-primary btn-block" className="btn btn-primary btn-block margin-top-20"
onClick={ this.loginSeed } onClick={ this.loginSeed }
disabled={ !this.state.loginPassphrase || !this.state.loginPassphrase.length }>{ translate('INDEX.SIGN_IN') }</button> disabled={ !this.state.loginPassphrase || !this.state.loginPassphrase.length }>{ translate('INDEX.SIGN_IN') }</button>
<div className="form-group form-material floating"> <div className="form-group form-material floating">

3
react/src/translate/en.js

@ -575,7 +575,8 @@ export const _lang = {
'NXT_SEED': 'NXT', 'NXT_SEED': 'NXT',
'SEED_COPIED': 'Seed copied', 'SEED_COPIED': 'Seed copied',
'SEED_SUCCESSFULLY_COPIED': 'The seed was successfully copied', 'SEED_SUCCESSFULLY_COPIED': 'The seed was successfully copied',
'ENCRYPT_PASSWORD': 'Encrypt password', 'ENCRYPT_SEED': 'Encrypt login seed',
'PUBKEY': 'pubkey',
'ENCRYPT_KEY': 'Encrypt key', 'ENCRYPT_KEY': 'Encrypt key',
'DECRYPT_KEY': 'Decrypt key' 'DECRYPT_KEY': 'Decrypt key'
}, },

Loading…
Cancel
Save