Merge branch 'master' into ticket/TURNIERE-247
This commit is contained in:
commit
6afd692dbc
10
js/api.js
10
js/api.js
|
|
@ -50,6 +50,7 @@ const reducerUserinfo = (state = defaultStateUserinfo, action) => {
|
||||||
__store.dispatch({
|
__store.dispatch({
|
||||||
type: actionTypesUserinfo.REGISTER_RESULT_SUCCESS
|
type: actionTypesUserinfo.REGISTER_RESULT_SUCCESS
|
||||||
});
|
});
|
||||||
|
action.parameters.successCallback();
|
||||||
storeOptionalToken(resp);
|
storeOptionalToken(resp);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
|
|
@ -70,6 +71,7 @@ const reducerUserinfo = (state = defaultStateUserinfo, action) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
action.parameters.errorCallback();
|
||||||
});
|
});
|
||||||
return Object.assign({}, state, {});
|
return Object.assign({}, state, {});
|
||||||
case actionTypesUserinfo.REGISTER_RESULT_SUCCESS:
|
case actionTypesUserinfo.REGISTER_RESULT_SUCCESS:
|
||||||
|
|
@ -182,7 +184,7 @@ const reducerTournamentinfo = (state = defaultStateTournamentinfo, action) => {
|
||||||
case actionTypesTournamentinfo.CREATE_TOURNAMENT:
|
case actionTypesTournamentinfo.CREATE_TOURNAMENT:
|
||||||
postRequest(action.state, '/tournaments', action.parameters.tournament).then(resp => {
|
postRequest(action.state, '/tournaments', action.parameters.tournament).then(resp => {
|
||||||
storeOptionalToken(resp);
|
storeOptionalToken(resp);
|
||||||
action.parameters.successCallback();
|
action.parameters.successCallback(resp.data);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
storeOptionalToken(error.response);
|
storeOptionalToken(error.response);
|
||||||
|
|
@ -357,13 +359,15 @@ export function verifyCredentials() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function register(username, email, password) {
|
export function register(username, email, password, successCallback, errorCallback) {
|
||||||
__store.dispatch({
|
__store.dispatch({
|
||||||
type: actionTypesUserinfo.REGISTER,
|
type: actionTypesUserinfo.REGISTER,
|
||||||
parameters: {
|
parameters: {
|
||||||
username: username,
|
username: username,
|
||||||
email: email,
|
email: email,
|
||||||
password: password
|
password: password,
|
||||||
|
successCallback: successCallback,
|
||||||
|
errorCallback: errorCallback
|
||||||
},
|
},
|
||||||
state: __store.getState()
|
state: __store.getState()
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import {Footer} from '../js/components/Footer';
|
||||||
import EditableStringList from '../js/components/EditableStringList';
|
import EditableStringList from '../js/components/EditableStringList';
|
||||||
import {createTournament} from '../js/api';
|
import {createTournament} from '../js/api';
|
||||||
import {WarningPopup} from '../js/components/WarningPopup';
|
import {WarningPopup} from '../js/components/WarningPopup';
|
||||||
|
import Router from 'next/router';
|
||||||
|
|
||||||
import '../static/css/everypage.css';
|
import '../static/css/everypage.css';
|
||||||
import RequireLogin from '../js/components/RequireLogin';
|
import RequireLogin from '../js/components/RequireLogin';
|
||||||
|
|
@ -216,8 +217,8 @@ class CreateTournamentForm extends React.Component {
|
||||||
|
|
||||||
create() {
|
create() {
|
||||||
if (this.valuesAreCredible()) {
|
if (this.valuesAreCredible()) {
|
||||||
createTournament(this.generateTournamentCreationObject(), () => {
|
createTournament(this.generateTournamentCreationObject(), data => {
|
||||||
notify.show('Das Turnier wurde erfolgreich erstellt.', 'success', 5000);
|
Router.push('/t/' + data.id);
|
||||||
}, () => {
|
}, () => {
|
||||||
notify.show('Das Turnier konnte nicht erstellt werden.', 'warning', 5000);
|
notify.show('Das Turnier konnte nicht erstellt werden.', 'warning', 5000);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,8 @@ function PublicTournaments(props) {
|
||||||
<PublicTournamentsCard/>
|
<PublicTournamentsCard/>
|
||||||
</Container>
|
</Container>
|
||||||
<Container className="pb-5 pt-3">
|
<Container className="pb-5 pt-3">
|
||||||
<a href='/private' className="btn btn-success shadow">zu den privaten Turnieren</a>
|
<a href='/private' className="btn btn-primary shadow">zu den privaten Turnieren</a>
|
||||||
|
<a href='/create' className="ml-3 btn btn-success shadow">neues Turnier erstellen</a>
|
||||||
</Container>
|
</Container>
|
||||||
</div>);
|
</div>);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class PrivateTournamentsPage extends React.Component {
|
||||||
<title>Private Turniere: turnie.re</title>
|
<title>Private Turniere: turnie.re</title>
|
||||||
</Head>
|
</Head>
|
||||||
<TurniereNavigation/>
|
<TurniereNavigation/>
|
||||||
<PrivateTournamentsPageContent/>
|
<PrivateTournamentsPageContent isSignedIn={this.props.isSignedIn}/>
|
||||||
<Footer/>
|
<Footer/>
|
||||||
</div>
|
</div>
|
||||||
</RequireLogin>);
|
</RequireLogin>);
|
||||||
|
|
@ -35,13 +35,14 @@ const PrivateTournamentListPage = connect(mapStateToProperties)(PrivateTournamen
|
||||||
|
|
||||||
export default PrivateTournamentListPage;
|
export default PrivateTournamentListPage;
|
||||||
|
|
||||||
function PrivateTournamentsPageContent() {
|
function PrivateTournamentsPageContent(props) {
|
||||||
return (<div>
|
return (<div>
|
||||||
<Container className="pt-5">
|
<Container className="pt-5">
|
||||||
<PrivateTournamentsCard/>
|
<PrivateTournamentsCard/>
|
||||||
</Container>
|
</Container>
|
||||||
<Container className="pb-5 pt-3">
|
<Container className="pb-5 pt-3">
|
||||||
<a href='/list' className="btn btn-success shadow">zu den öffentlichen Turnieren</a>
|
<a href='/list' className="btn btn-primary shadow">zu den öffentlichen Turnieren</a>
|
||||||
|
{props.isSignedIn && <a href='/create' className="ml-3 btn btn-success shadow">neues Turnier erstellen</a>}
|
||||||
</Container>
|
</Container>
|
||||||
</div>);
|
</div>);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +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 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';
|
||||||
|
|
@ -69,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)}/>
|
||||||
|
|
@ -95,12 +102,30 @@ class RegisterForm extends React.Component {
|
||||||
<FormText className="mb-2 mt-4">
|
<FormText className="mb-2 mt-4">
|
||||||
Du akzeptierst die <a href="/privacy">Datenschutzbestimmungen</a>, wenn du auf Registrieren klickst.
|
Du akzeptierst die <a href="/privacy">Datenschutzbestimmungen</a>, wenn du auf Registrieren klickst.
|
||||||
</FormText>
|
</FormText>
|
||||||
<Button onClick={register.bind(this, this.state.username, this.state.email, this.state.password)}
|
<Button onClick={() => this.registerUser()}
|
||||||
color="success" size="lg" className="w-100 shadow-sm">Registrieren</Button>
|
color="success" size="lg" className="w-100 shadow-sm">Registrieren</Button>
|
||||||
<VisibleRegisterErrorList/>
|
<VisibleRegisterErrorList/>
|
||||||
</Form>);
|
</Form>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showRegisterSuccessModal() {
|
||||||
|
this.setState({
|
||||||
|
showRegisterSuccessModal: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
closeRegisterSuccessModal() {
|
||||||
|
Router.push('/');
|
||||||
|
}
|
||||||
|
|
||||||
|
registerUser() {
|
||||||
|
register(this.state.username, this.state.email, this.state.password, () => {
|
||||||
|
this.showRegisterSuccessModal();
|
||||||
|
}, () => {
|
||||||
|
notify.show('Sie konnten nicht registriert werden.', 'warning', 5000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
handlePasswordInput(input) {
|
handlePasswordInput(input) {
|
||||||
this.setState({password: input.target.value});
|
this.setState({password: input.target.value});
|
||||||
}
|
}
|
||||||
|
|
@ -114,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