From 9c3c78cbf2476c5e69f193f8c29514291681418e Mon Sep 17 00:00:00 2001 From: Laura Fuentes Grau Date: Sat, 10 Oct 2020 21:27:23 +0200 Subject: [PATCH] WIP: Add option to recover forgotten password #260 --- src/user/login-form.js | 15 +++++++- src/user/recover-password.js | 72 ++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 src/user/recover-password.js diff --git a/src/user/login-form.js b/src/user/login-form.js index 96df3b0..1c2fc5e 100644 --- a/src/user/login-form.js +++ b/src/user/login-form.js @@ -17,7 +17,7 @@ import React, { Component } from 'react'; import { Form, Button, FormGroup, FormControl, FormLabel, Col } from 'react-bootstrap'; - +import RecoverPassword from './recover-password' import AppDispatcher from '../common/app-dispatcher'; class LoginForm extends Component { @@ -27,6 +27,7 @@ class LoginForm extends Component { this.state = { username: '', password: '', + forgottenPassword: false, disableLogin: true } } @@ -55,6 +56,14 @@ class LoginForm extends Component { this.setState({ [event.target.id]: event.target.value, disableLogin }); } + openRecoverPassword(){ + this.setState({forgottenPassword: true}); + } + + closeRecoverPassword(){ + this.setState({forgottenPassword: false}); + } + render() { return (
@@ -83,10 +92,14 @@ class LoginForm extends Component { + + + this.closeRecoverPassword()} sessionToken={this.props.sessionToken} /> + ); } } diff --git a/src/user/recover-password.js b/src/user/recover-password.js new file mode 100644 index 0000000..c278b46 --- /dev/null +++ b/src/user/recover-password.js @@ -0,0 +1,72 @@ +/** + * This file is part of VILLASweb. + * + * VILLASweb is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * VILLASweb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with VILLASweb. If not, see . + ******************************************************************************/ + +import React from 'react'; +import Dialog from '../common/dialogs/dialog'; +import {Col, Row} from 'react-bootstrap'; + + +class RecoverPassword extends React.Component { + constructor(props) { + super(props); + + this.state = { + admins: this.props.admins + } + } + + + onClose() { + this.props.onClose(); + } + + + + + + + render() { + return ( + this.onClose(c)} blendOutCancel = {true} valid={true}> +
+ Please contact an administrator +
+ {this.state.admins != null && this.state.admins.map(admin => ( +
+ + Admin: + {admin.username} + + + + + E-mail: + {admin.mail} + + +
+ ))} +
+ + +
+
+ ); + } +} + +export default RecoverPassword;