summaryrefslogtreecommitdiff
path: root/web-ui/src/account_recovery/page.js
diff options
context:
space:
mode:
authorAnike Arni <aarni@thoughtworks.com>2017-03-28 11:26:11 -0300
committerAnike Arni <aarni@thoughtworks.com>2017-03-28 11:44:41 -0300
commitd39f2b2907aa49f5fa383d2246875220a77c818c (patch)
tree709d4060372048f90c6fa991586b572d3cdb913c /web-ui/src/account_recovery/page.js
parent7a6419d1628db465ebd543fac187012e58b67138 (diff)
[#932] Adds logic to go to next step
Diffstat (limited to 'web-ui/src/account_recovery/page.js')
-rw-r--r--web-ui/src/account_recovery/page.js48
1 files changed, 36 insertions, 12 deletions
diff --git a/web-ui/src/account_recovery/page.js b/web-ui/src/account_recovery/page.js
index 2a2f6fe6..93781729 100644
--- a/web-ui/src/account_recovery/page.js
+++ b/web-ui/src/account_recovery/page.js
@@ -20,25 +20,49 @@ import { translate } from 'react-i18next';
import DocumentTitle from 'react-document-title';
import Header from 'src/common/header/header';
import AdminRecoveryCodeForm from 'src/account_recovery/forms/admin_recovery_code_form';
+import UserRecoveryCodeForm from 'src/account_recovery/forms/user_recovery_code_form';
import Footer from 'src/common/footer/footer';
import 'font-awesome/scss/font-awesome.scss';
import './page.scss';
-export const Page = ({ t }) => (
- <DocumentTitle title={t('account-recovery.page-title')}>
- <div className='page'>
- <Header />
- <section>
- <div className='container'>
- <AdminRecoveryCodeForm />
+export class Page extends React.Component {
+
+ constructor(props) {
+ super(props);
+ this.state = { step: 0 };
+ }
+
+ nextStep = (event) => {
+ event.preventDefault();
+ this.setState({ step: this.state.step + 1 });
+ }
+
+ steps = {
+ 0: <AdminRecoveryCodeForm next={this.nextStep} />,
+ 1: <UserRecoveryCodeForm />
+ }
+
+ mainContent = () => this.steps[this.state.step];
+
+ render() {
+ const t = this.props.t;
+ return (
+ <DocumentTitle title={t('account-recovery.page-title')}>
+ <div className='page'>
+ <Header />
+ <section>
+ <div className='container'>
+ {this.mainContent()}
+ </div>
+ </section>
+ <Footer />
</div>
- </section>
- <Footer />
- </div>
- </DocumentTitle>
-);
+ </DocumentTitle>
+ );
+ }
+}
Page.propTypes = {
t: React.PropTypes.func.isRequired