This repository has been archived by the owner on Dec 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add password to wallet, confirmation popup update, rr update
- Loading branch information
Showing
8 changed files
with
148 additions
and
12,181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,15 @@ | |
"name": "cyb", | ||
"description": "Web3 browser", | ||
"main": "public/electron.js", | ||
"version": "0.0.32", | ||
"version": "0.0.33", | ||
"author": { | ||
"name": "cybercongress", | ||
"email": "[email protected]" | ||
}, | ||
"private": true, | ||
"homepage": "./", | ||
"dependencies": { | ||
"@cybercongress/ui": "^0.0.5", | ||
"@cybercongress/ui": ">=0.0.6", | ||
"axios": "0.18.0", | ||
"bech32": "1.1.3", | ||
"bip39": "2.5.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import React, { Component } from 'react'; | ||
import connect from 'react-redux/es/connect/connect'; | ||
import { Message } from '@cybercongress/ui'; | ||
import Block, { BlockRow } from '../../components/Settings/Block'; | ||
import { SettingLabel, SettingRow } from '../../components/Settings/Settings'; | ||
import Input from '../../components/Input/Input'; | ||
import Button from '../../components/Button/Button'; | ||
import { createPassword, login } from '../../redux/wallet'; | ||
|
||
class RequirePassword extends Component { | ||
|
||
state = { | ||
createPassword: false, | ||
}; | ||
|
||
login = () => { | ||
const password = this.password.value; | ||
|
||
this.props.setPassword(password); | ||
}; | ||
|
||
setPassord = () => { | ||
this.setState({ createPassword: true }); | ||
}; | ||
|
||
cancel = () => { | ||
this.setState({ createPassword: false }); | ||
}; | ||
|
||
createPassword = () => { | ||
const password1 = this.password1.value; | ||
const password2 = this.password2.value; | ||
|
||
if (password1 === password2) { | ||
this.props.createPassword(password1); | ||
} | ||
}; | ||
|
||
render() { | ||
const { incorrectPassword } = this.props; | ||
const { createPassword } = this.state; | ||
|
||
return ( | ||
<Block style={ { width: 400 } }> | ||
{createPassword ? ( | ||
<div> | ||
<BlockRow key='create1'> | ||
<SettingRow> | ||
<SettingLabel>password</SettingLabel> | ||
<Input type='password' inputRef={ node => this.password1 = node } /> | ||
</SettingRow> | ||
</BlockRow> | ||
<BlockRow key='create2'> | ||
<SettingRow> | ||
<SettingLabel>confirm password</SettingLabel> | ||
<Input type='password' inputRef={ node => this.password2 = node } /> | ||
</SettingRow> | ||
</BlockRow> | ||
<BlockRow> | ||
<div style={ { | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
} } | ||
> | ||
<Button onClick={ this.cancel }>cancel</Button> | ||
<Button onClick={ this.createPassword } color='green'>create</Button> | ||
</div> | ||
</BlockRow> | ||
</div> | ||
) : ( | ||
<div> | ||
{incorrectPassword && ( | ||
<BlockRow> | ||
<Message type='error'>incorrect password</Message> | ||
</BlockRow> | ||
)} | ||
<BlockRow> | ||
<SettingRow key='login'> | ||
<SettingLabel>password</SettingLabel> | ||
<Input type='password' inputRef={ node => this.password = node } /> | ||
</SettingRow> | ||
</BlockRow> | ||
<BlockRow> | ||
<div style={ { | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
} } | ||
> | ||
<Button onClick={ this.setPassord }>set passord</Button> | ||
<Button onClick={ this.login } color='green'>login</Button> | ||
</div> | ||
</BlockRow> | ||
</div> | ||
)} | ||
</Block> | ||
); | ||
} | ||
} | ||
|
||
export default connect(state => ({ | ||
password: state.wallet.password, | ||
incorrectPassword: state.wallet.incorrectPassword, | ||
}), { setPassword: login, createPassword })(RequirePassword); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.