From 10b0b4462107ecebffab4ce3eb0435d3c1b2dd24 Mon Sep 17 00:00:00 2001 From: elijah Date: Thu, 29 Sep 2016 17:00:47 -0700 Subject: [feat] ui - allow users to change their passwords --- ui/app/components/main_panel/user_section.js | 78 ++++++++++++++++++---------- 1 file changed, 50 insertions(+), 28 deletions(-) (limited to 'ui/app/components/main_panel/user_section.js') diff --git a/ui/app/components/main_panel/user_section.js b/ui/app/components/main_panel/user_section.js index acaea234..317f9931 100644 --- a/ui/app/components/main_panel/user_section.js +++ b/ui/app/components/main_panel/user_section.js @@ -1,6 +1,8 @@ import React from 'react' import { Button, Glyphicon, Alert } from 'react-bootstrap' import SectionLayout from './section_layout' +import UserPasswordForm from './user_password_form' + import Login from 'components/login' import Spinner from 'components/spinner' import Account from 'models/account' @@ -19,9 +21,11 @@ export default class UserSection extends React.Component { super(props) this.state = { error: null, - loading: false + loading: false, + expanded: false, } this.logout = this.logout.bind(this) + this.expand = this.expand.bind(this) } logout() { @@ -38,42 +42,60 @@ export default class UserSection extends React.Component { ) } + expand() { + this.setState({expanded: !this.state.expanded}) + } + render () { + if (this.props.account.authenticated) { + return this.renderAccount() + } else { + return this.renderLoginForm() + } + } + + renderAccount() { + let button = null let message = null + let body = null + let header =

{this.props.account.address}

+ if (this.state.error) { // style may be: success, warning, danger, info message = ( {this.state.error} ) } - - if (this.props.account.authenticated) { - let button = null - if (this.state.loading) { - button = - } else { - button = - } - return ( - -

{this.props.account.address}

- {message} -
- ) + if (this.state.expanded) { + body = + } + if (this.state.loading) { + button = } else { - let address = null - if (this.props.account.userpart) { - address = this.props.account.address - } - return ( - - - - ) + button = + } + + return ( + + ) + } + + renderLoginForm() { + let address = null + if (this.props.account.userpart) { + address = this.props.account.address } + let header = ( + + ) + return ( + + ) } + } -- cgit v1.2.3