Add modal to describe registration process instead of a toast
This commit is contained in:
parent
70047a2e55
commit
8baa6fe9f0
|
|
@ -1,10 +1,12 @@
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import {notify} from 'react-notify-toast';
|
import {notify} from 'react-notify-toast';
|
||||||
import Router from 'next/router';
|
import Router from 'next/router';
|
||||||
import {
|
import {
|
||||||
Button, Card, CardBody, Container, Form, FormGroup, FormText, Input, Label
|
Button, Card, CardBody, Container, Form, FormGroup, FormText, Input, Label,
|
||||||
|
Modal, ModalHeader, ModalBody, ModalFooter
|
||||||
} from 'reactstrap';
|
} from 'reactstrap';
|
||||||
|
|
||||||
import {TurniereNavigation} from '../js/components/Navigation';
|
import {TurniereNavigation} from '../js/components/Navigation';
|
||||||
|
|
@ -71,12 +73,15 @@ class RegisterForm extends React.Component {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
username: '', email: '', password: ''
|
username: '', email: '', password: '',
|
||||||
|
showRegisterSuccessModal: false, code: -1
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (<Form>
|
return (<Form>
|
||||||
|
<RegisterSuccessModal isOpen={this.state.showRegisterSuccessModal}
|
||||||
|
close={() => this.closeRegisterSuccessModal()}/>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<Label for="username">Benutzername</Label>
|
<Label for="username">Benutzername</Label>
|
||||||
<Input name="username" value={this.state.username} onChange={this.handleUsernameInput.bind(this)}/>
|
<Input name="username" value={this.state.username} onChange={this.handleUsernameInput.bind(this)}/>
|
||||||
|
|
@ -103,14 +108,22 @@ class RegisterForm extends React.Component {
|
||||||
</Form>);
|
</Form>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showRegisterSuccessModal() {
|
||||||
|
this.setState({
|
||||||
|
showRegisterSuccessModal: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
closeRegisterSuccessModal() {
|
||||||
|
Router.push('/');
|
||||||
|
}
|
||||||
|
|
||||||
registerUser() {
|
registerUser() {
|
||||||
register(
|
register(this.state.username, this.state.email, this.state.password, () => {
|
||||||
this.state.username, this.state.email, this.state.password, () => {
|
this.showRegisterSuccessModal();
|
||||||
notify.show('Sie wurden erfolgreich registriert, ' + this.state.username + '!', 'success', 5000);
|
}, () => {
|
||||||
Router.push('/');
|
notify.show('Sie konnten nicht registriert werden.', 'warning', 5000);
|
||||||
}, () => {
|
});
|
||||||
notify.show('Sie konnten nicht registriert werden.', 'warning', 5000);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handlePasswordInput(input) {
|
handlePasswordInput(input) {
|
||||||
|
|
@ -126,6 +139,26 @@ class RegisterForm extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RegisterSuccessModal extends React.Component {
|
||||||
|
render() {
|
||||||
|
return (<Modal isOpen={this.props.isOpen} toggle={this.props.close}>
|
||||||
|
<ModalHeader toggle={this.props.close}>Erfolgreich registriert</ModalHeader>
|
||||||
|
<ModalBody>
|
||||||
|
Sie wurden erfolgreich registriert. Um Ihren Account nutzen zu können
|
||||||
|
müssen Sie den Verifizierungslink, den wir Ihnen per E-Mail zugesandt haben, aufrufen.
|
||||||
|
</ModalBody>
|
||||||
|
<ModalFooter>
|
||||||
|
<Button color='secondary' onClick={this.props.close}>Verstanden</Button>
|
||||||
|
</ModalFooter>
|
||||||
|
</Modal>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RegisterSuccessModal.proptypes = {
|
||||||
|
isOpen: PropTypes.bool.isRequired,
|
||||||
|
close: PropTypes.func.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
function AccountRequirementMarketing() {
|
function AccountRequirementMarketing() {
|
||||||
return (<Container>
|
return (<Container>
|
||||||
<Card id="account-requirement">
|
<Card id="account-requirement">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue