From 04e21be3c14791f28c604c0c4369d2167d9f01a3 Mon Sep 17 00:00:00 2001 From: Matteo V Date: Fri, 7 Oct 2016 11:59:38 +0200 Subject: [PATCH] Fixed #1087 : Login dialog now is destroyed when it is closed (#1091) * Fixed #1087 : Login dialog now is destroyed when it is closed * changed all login tools to dialog * fixed french translation --- .../components/security/forms/LoginForm.jsx | 7 --- .../security/forms/PasswordReset.jsx | 9 +--- .../components/security/modals/LoginModal.jsx | 45 ++++++++++--------- .../security/modals/PasswordResetModal.jsx | 36 +++++++++------ .../security/modals/UserDetailsModal.jsx | 39 ++++++++-------- web/client/localConfig.json | 21 ++++++++- web/client/plugins/CreateNewMap.jsx | 2 +- web/client/translations/data.en-US | 1 + web/client/translations/data.fr-FR | 3 +- web/client/translations/data.it-IT | 1 + 10 files changed, 89 insertions(+), 75 deletions(-) diff --git a/web/client/components/security/forms/LoginForm.jsx b/web/client/components/security/forms/LoginForm.jsx index 312cd2e46b..8b0505d420 100644 --- a/web/client/components/security/forms/LoginForm.jsx +++ b/web/client/components/security/forms/LoginForm.jsx @@ -5,13 +5,6 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ - /** - * Copyright 2016, GeoSolutions Sas. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ const React = require('react'); const {Input, ButtonInput, Alert} = require('react-bootstrap'); diff --git a/web/client/components/security/forms/PasswordReset.jsx b/web/client/components/security/forms/PasswordReset.jsx index 0e4c2475bf..ebe972f9e3 100644 --- a/web/client/components/security/forms/PasswordReset.jsx +++ b/web/client/components/security/forms/PasswordReset.jsx @@ -5,13 +5,6 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ - /** - * Copyright 2016, GeoSolutions Sas. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ const React = require('react'); const {Input, Alert} = require('react-bootstrap'); @@ -68,7 +61,7 @@ const PasswordReset = React.createClass({ return null; } let pw = this.refs.password.getValue(); - if (pw !== null && pw.length < this.props.minPasswordSize) { + if (pw !== null && pw.length < this.props.minPasswordSize && pw.length > 0) { return ; } else if (pw !== null && pw !== this.refs.passwordcheck.getValue() ) { return ; diff --git a/web/client/components/security/modals/LoginModal.jsx b/web/client/components/security/modals/LoginModal.jsx index c36493a8ee..841cbae86e 100644 --- a/web/client/components/security/modals/LoginModal.jsx +++ b/web/client/components/security/modals/LoginModal.jsx @@ -5,13 +5,6 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ - /** - * Copyright 2016, GeoSolutions Sas. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ const React = require('react'); const LoginForm = require('../forms/LoginForm'); @@ -61,8 +54,8 @@ const LoginModal = React.createClass({ includeCloseButton: true }; }, - render() { - const form = (); - const footer = ( + />); + }, + getFooter() { + return ( : } + onClick={this.props.onClose}> : } ); - return this.props.useModal ? ( + }, + renderModal() { + return ( - {form} + {this.getForm()} - {footer} + {this.getFooter()} - ) : ( - - - {form} - {footer} - - ); + ); + }, + renderDialog() { + return (this.props.show) ? ( + + {this.getForm()} + {this.getFooter()} + ) : null; + }, + render() { + return this.props.useModal ? this.renderModal() : this.renderDialog(); }, loginSubmit() { this.refs.loginForm.submit(); diff --git a/web/client/components/security/modals/PasswordResetModal.jsx b/web/client/components/security/modals/PasswordResetModal.jsx index ea5d352533..58f6fe25f9 100644 --- a/web/client/components/security/modals/PasswordResetModal.jsx +++ b/web/client/components/security/modals/PasswordResetModal.jsx @@ -11,7 +11,7 @@ const PasswordReset = require('../forms/PasswordReset'); const Message = require('../../../components/I18N/Message'); const {Modal, Button, Glyphicon} = require('react-bootstrap'); -const Dialog = require('../../../components/misc/Dialog'); +const Dialog = require('../../misc/Dialog'); const assign = require('object-assign'); const Spinner = require('react-spinkit'); @@ -26,6 +26,8 @@ const PasswordResetModal = React.createClass({ authHeader: React.PropTypes.string, show: React.PropTypes.bool, options: React.PropTypes.object, + + onPasswordChange: React.PropTypes.func, onPasswordChanged: React.PropTypes.func, onClose: React.PropTypes.func, @@ -75,8 +77,8 @@ const PasswordResetModal = React.createClass({ renderLoading() { return this.state.loading ? : null; }, - render() { - const footer = (
{this.renderLoading()}
+ getFooter() { + return (
{this.renderLoading()}
: } ); - const body = ( { this.setState({passwordValid: this.refs.passwordResetForm.isValid()}); }} />); - return this.props.useModal ? ( + }, + renderModal() { + return ( - {body} + {this.getBody()} - {footer} + {this.getFooter()} - ) : ( - + ); + }, + renderDialog() { + return (this.props.show) ? ( - {body} - {footer} - - ); + {this.getBody()} + {this.getFooter()} + ) : null; + }, + render() { + return this.props.useModal ? this.renderModal() : this.renderDialog(); } }); diff --git a/web/client/components/security/modals/UserDetailsModal.jsx b/web/client/components/security/modals/UserDetailsModal.jsx index 7cc92f5ae9..cb15c49647 100644 --- a/web/client/components/security/modals/UserDetailsModal.jsx +++ b/web/client/components/security/modals/UserDetailsModal.jsx @@ -5,14 +5,6 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ - /** - * Copyright 2016, GeoSolutions Sas. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - const React = require('react'); const {Modal, Button, Table, Alert, Glyphicon} = require('react-bootstrap'); @@ -67,26 +59,31 @@ const UserDetails = React.createClass({ } return ; }, - render() { - const footer = this.props.includeCloseButton ? : ; - return this.props.useModal ? ( - + getFooter() { + return (this.props.includeCloseButton ? : ); + }, + renderModal() { + return ( - User Details + {this.renderAttributes()} - {footer} + {this.getFooter()} - ) : ( - - Login - {this.renderAttributes()} - {footer} - - ); + ); + }, + renderDialog() { + return (this.props.show) ? ( + + {this.renderAttributes()} + {this.getFooter()} + ) : null; + }, + render() { + return this.props.useModal ? this.renderModal() : this.renderDialog(); } }); diff --git a/web/client/localConfig.json b/web/client/localConfig.json index a8b296b775..63896f202d 100644 --- a/web/client/localConfig.json +++ b/web/client/localConfig.json @@ -733,8 +733,25 @@ "nav": false, "menuProps": { "noCaret": true - } - } + }, + "toolsCfg": [{ + "buttonSize": "small", + "includeCloseButton": false, + "useModal": false, + "closeGlyph": "1-close" + }, { + "buttonSize": "small", + "includeCloseButton": false, + "useModal": false, + "closeGlyph": "1-close" + }, { + "buttonSize": "small", + "includeCloseButton": false, + "useModal": false, + "closeGlyph": "1-close" + }] + + } }, {"name": "Language"}, { "name" : "Attribution", "hide": true diff --git a/web/client/plugins/CreateNewMap.jsx b/web/client/plugins/CreateNewMap.jsx index 307395abc7..77c7001343 100644 --- a/web/client/plugins/CreateNewMap.jsx +++ b/web/client/plugins/CreateNewMap.jsx @@ -38,7 +38,7 @@ const CreateNewMap = React.createClass({ render() { const display = this.props.isLoggedIn ? null : "none"; - return ( + return (