augur-ui-react-components
Advanced tools
Comparing version 3.0.13 to 3.0.14
{ | ||
"name": "augur-ui-react-components", | ||
"version": "3.0.13", | ||
"version": "3.0.14", | ||
"description": "Augur UI React Components", | ||
@@ -5,0 +5,0 @@ "author": "Baz (@thinkloop)", |
import React, { PropTypes, Component } from 'react'; | ||
import SiteHeader from '../../site/components/site-header'; | ||
@@ -10,3 +9,2 @@ import SiteFooter from '../../site/components/site-footer'; | ||
static propTypes = { | ||
onChangePass: PropTypes.func, | ||
account: PropTypes.object, | ||
@@ -18,7 +16,5 @@ siteHeader: PropTypes.object | ||
super(props); | ||
this.handleSubmit = this.handleSubmit.bind(this); | ||
this.state = { | ||
name: this.props.account.name, | ||
editName: false, | ||
editPassword: false, | ||
showFullID: false, | ||
@@ -29,18 +25,6 @@ msg: '' | ||
handleSubmit = (e) => { | ||
e.preventDefault(); | ||
// save values so that they will be used in the timeout. | ||
const password = this.refs.password && this.refs.password.value; | ||
const newPassword = this.refs.newPassword && this.refs.newPassword.value; | ||
const newPassword2 = this.refs.newPassword2 && this.refs.newPassword2.value; | ||
setTimeout(() => | ||
this.props.onChangePass( | ||
password, newPassword, newPassword2, this.setState.bind(this) | ||
), 100); | ||
} | ||
render() { | ||
const p = this.props; | ||
const s = this.state; | ||
// console.log(p); | ||
return ( | ||
@@ -80,3 +64,3 @@ <main className="page account"> | ||
<button | ||
className="link" onClick={() => { if (!s.editPassword) this.setState({ editName: true }); }} | ||
className="link" onClick={() => this.setState({ editName: true })} | ||
title="Click here to change your Account Name" | ||
@@ -90,3 +74,3 @@ > | ||
className="button" | ||
onClick={() => { this.setState({ name: '', editName: false }); }} | ||
onClick={() => this.setState({ name: '', editName: false })} | ||
title="Cancel without saving new name" | ||
@@ -101,6 +85,4 @@ > | ||
onClick={() => { | ||
if (!s.editPassword) { | ||
p.account.editName(s.name); | ||
this.setState({ name: '', editName: false }); | ||
} | ||
p.account.editName(s.name); | ||
this.setState({ name: '', editName: false }); | ||
}} | ||
@@ -131,3 +113,3 @@ title="Save new account name" | ||
const showHide = !s.showFullID; | ||
if (!s.editPassword) this.setState({ showFullID: showHide }); | ||
this.setState({ showFullID: showHide }); | ||
}} | ||
@@ -139,83 +121,2 @@ > | ||
</tr> | ||
<tr className="account-info-item"> | ||
<th className="title">Password:</th> | ||
{!s.editPassword && | ||
<td className="item"> | ||
<span>************</span> | ||
<button | ||
className="link" | ||
onClick={() => this.setState({ editPassword: true })} | ||
title="Click here to Change your Password." | ||
> | ||
(change password) | ||
</button> | ||
{s.msg !== '' && | ||
<div className="password-msg"> | ||
<span> | ||
{s.msg} | ||
</span> | ||
<span | ||
className="dismiss-message" | ||
title="Click to dismiss message" | ||
onClick={() => this.setState({ msg: '' })} | ||
> | ||
 | ||
</span> | ||
</div> | ||
} | ||
</td> | ||
} | ||
{s.editPassword && | ||
<td className="item password-change-container"> | ||
<form onSubmit={this.handleSubmit}> | ||
<input | ||
className="input box" | ||
ref="password" | ||
type="password" | ||
maxLength="256" | ||
placeholder="current password" | ||
title="enter your current password here" | ||
/> | ||
<br /> | ||
<input | ||
className="input box" | ||
ref="newPassword" | ||
type="password" | ||
maxLength="256" | ||
placeholder="new password" | ||
title="enter your desired new password here" | ||
/> | ||
<br /> | ||
<input | ||
className="input box" | ||
ref="newPassword2" | ||
type="password" | ||
maxLength="256" | ||
placeholder="confirm new password" | ||
title="re-enter your new password for confirmation" | ||
/> | ||
<br /> | ||
<button | ||
type="button" | ||
title="Cancel password change and keep your current Password." | ||
className="button" | ||
onClick={() => this.setState({ editPassword: false })} | ||
> | ||
cancel | ||
</button> | ||
<button | ||
className="button make" | ||
type="submit" | ||
title="Click here to save your new Password." | ||
> | ||
confirm password change | ||
</button> | ||
</form> | ||
</td> | ||
} | ||
</tr> | ||
</tbody> | ||
@@ -222,0 +123,0 @@ </table> |
@@ -22,3 +22,2 @@ import { emptyNumber } from '../utils/empty-number'; | ||
editName: loginAccount.editName, | ||
onChangePass: loginAccount.onChangePass, | ||
signOut: loginAccount.signOut | ||
@@ -35,7 +34,2 @@ } | ||
loginAccount.onChangePass = (password, newPassword, newPassword2, cb) => { | ||
console.log(`Password: ${password}.`, `New Password: ${newPassword}.`, `Confirmed New Password: ${newPassword2}.`, 'This function would trigger a password change in Augur + validation.'); | ||
cb({ msg: 'your Password has been successfully changed!', editPassword: false }); | ||
}; | ||
loginAccount.signIn = (name = loginAccount.name) => { | ||
@@ -47,3 +41,2 @@ loginAccount.update({ loginAccount: { | ||
editName: loginAccount.editName, | ||
onChangePass: loginAccount.onChangePass, | ||
signOut: loginAccount.signOut | ||
@@ -50,0 +43,0 @@ } |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1183476
7907