Skip to content

Commit 77d5885

Browse files
MV88offtherailz
authored andcommitted
Fixed #1087 : Login dialog now is destroyed when it is closed (#1091) (#1097)
* Fixed #1087 : Login dialog now is destroyed when it is closed * changed all login tools to dialog
1 parent 42ae8fb commit 77d5885

File tree

10 files changed

+89
-75
lines changed

10 files changed

+89
-75
lines changed

web/client/components/security/forms/LoginForm.jsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55
* This source code is licensed under the BSD-style license found in the
66
* LICENSE file in the root directory of this source tree.
77
*/
8-
/**
9-
* Copyright 2016, GeoSolutions Sas.
10-
* All rights reserved.
11-
*
12-
* This source code is licensed under the BSD-style license found in the
13-
* LICENSE file in the root directory of this source tree.
14-
*/
158

169
const React = require('react');
1710
const {Input, ButtonInput, Alert} = require('react-bootstrap');

web/client/components/security/forms/PasswordReset.jsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55
* This source code is licensed under the BSD-style license found in the
66
* LICENSE file in the root directory of this source tree.
77
*/
8-
/**
9-
* Copyright 2016, GeoSolutions Sas.
10-
* All rights reserved.
11-
*
12-
* This source code is licensed under the BSD-style license found in the
13-
* LICENSE file in the root directory of this source tree.
14-
*/
158

169
const React = require('react');
1710
const {Input, Alert} = require('react-bootstrap');
@@ -68,7 +61,7 @@ const PasswordReset = React.createClass({
6861
return null;
6962
}
7063
let pw = this.refs.password.getValue();
71-
if (pw !== null && pw.length < this.props.minPasswordSize) {
64+
if (pw !== null && pw.length < this.props.minPasswordSize && pw.length > 0) {
7265
return <Alert bsStyle="danger"><Message msgId="user.passwordMinlenght" msgParams={{minSize: this.props.minPasswordSize}}/></Alert>;
7366
} else if (pw !== null && pw !== this.refs.passwordcheck.getValue() ) {
7467
return <Alert bsStyle="danger"><Message msgId="user.passwordCheckFail" /></Alert>;

web/client/components/security/modals/LoginModal.jsx

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55
* This source code is licensed under the BSD-style license found in the
66
* LICENSE file in the root directory of this source tree.
77
*/
8-
/**
9-
* Copyright 2016, GeoSolutions Sas.
10-
* All rights reserved.
11-
*
12-
* This source code is licensed under the BSD-style license found in the
13-
* LICENSE file in the root directory of this source tree.
14-
*/
158

169
const React = require('react');
1710
const LoginForm = require('../forms/LoginForm');
@@ -61,8 +54,8 @@ const LoginModal = React.createClass({
6154
includeCloseButton: true
6255
};
6356
},
64-
render() {
65-
const form = (<LoginForm
57+
getForm() {
58+
return (<LoginForm
6659
role="body"
6760
ref="loginForm"
6861
showSubmitButton={false}
@@ -71,8 +64,10 @@ const LoginModal = React.createClass({
7164
onLoginSuccess={this.props.onLoginSuccess}
7265
onSubmit={this.props.onSubmit}
7366
onError={this.props.onError}
74-
/>);
75-
const footer = (<span role="footer">
67+
/>);
68+
},
69+
getFooter() {
70+
return (<span role="footer">
7671
<Button
7772
ref="submit"
7873
value={LocaleUtils.getMessageById(this.context.messages, "user.signIn")}
@@ -85,25 +80,31 @@ const LoginModal = React.createClass({
8580
key="closeButton"
8681
ref="closeButton"
8782
bsSize={this.props.buttonSize}
88-
onClick={this.props.onClose}>Close</Button> : <span/>}
83+
onClick={this.props.onClose}><Message msgId="close"/></Button> : <span/>}
8984
</span>);
90-
return this.props.useModal ? (<Modal {...this.props.options} show={this.props.show} onHide={this.props.onClose}>
85+
},
86+
renderModal() {
87+
return (<Modal {...this.props.options} show={this.props.show} onHide={this.props.onClose}>
9188
<Modal.Header key="passwordChange" closeButton>
9289
<Modal.Title><Message msgId="user.login"/></Modal.Title>
9390
</Modal.Header>
9491
<Modal.Body>
95-
{form}
92+
{this.getForm()}
9693
</Modal.Body>
9794
<Modal.Footer>
98-
{footer}
95+
{this.getFooter()}
9996
</Modal.Footer>
100-
</Modal>) : (
101-
<Dialog modal id="mapstore-login-panel" style={assign({}, this.props.style, {display: this.props.show ? "block" : "none"})}>
102-
<span role="header"><span className="login-panel-title"><Message msgId="user.login"/></span><button onClick={this.props.onClose} className="login-panel-close close">{this.props.closeGlyph ? <Glyphicon glyph={this.props.closeGlyph}/> : <span>×</span>}</button></span>
103-
{form}
104-
{footer}
105-
</Dialog>
106-
);
97+
</Modal>);
98+
},
99+
renderDialog() {
100+
return (this.props.show) ? (<Dialog modal id="mapstore-login-panel" style={assign({}, this.props.style, {display: "block" })}>
101+
<span role="header"><span className="login-panel-title"><Message msgId="user.login"/></span><button onClick={this.props.onClose} className="login-panel-close close">{this.props.closeGlyph ? <Glyphicon glyph={this.props.closeGlyph}/> : <span>×</span>}</button></span>
102+
{this.getForm()}
103+
{this.getFooter()}
104+
</Dialog>) : null;
105+
},
106+
render() {
107+
return this.props.useModal ? this.renderModal() : this.renderDialog();
107108
},
108109
loginSubmit() {
109110
this.refs.loginForm.submit();

web/client/components/security/modals/PasswordResetModal.jsx

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const PasswordReset = require('../forms/PasswordReset');
1111
const Message = require('../../../components/I18N/Message');
1212
const {Modal, Button, Glyphicon} = require('react-bootstrap');
1313

14-
const Dialog = require('../../../components/misc/Dialog');
14+
const Dialog = require('../../misc/Dialog');
1515
const assign = require('object-assign');
1616

1717
const Spinner = require('react-spinkit');
@@ -26,6 +26,8 @@ const PasswordResetModal = React.createClass({
2626
authHeader: React.PropTypes.string,
2727
show: React.PropTypes.bool,
2828
options: React.PropTypes.object,
29+
30+
2931
onPasswordChange: React.PropTypes.func,
3032
onPasswordChanged: React.PropTypes.func,
3133
onClose: React.PropTypes.func,
@@ -75,8 +77,8 @@ const PasswordResetModal = React.createClass({
7577
renderLoading() {
7678
return this.state.loading ? <Spinner spinnerName="circle" key="loadingSpinner" noFadeIn/> : null;
7779
},
78-
render() {
79-
const footer = (<span role="footer"><div style={{"float": "left"}}>{this.renderLoading()}</div>
80+
getFooter() {
81+
return (<span role="footer"><div style={{"float": "left"}}>{this.renderLoading()}</div>
8082
<Button
8183
ref="passwordChangeButton"
8284
key="passwordChangeButton"
@@ -93,28 +95,36 @@ const PasswordResetModal = React.createClass({
9395
bsSize={this.props.buttonSize}
9496
onClick={this.props.onClose}><Message msgId="close"/></Button> : <span/>}
9597
</span>);
96-
const body = (<PasswordReset role="body" ref="passwordResetForm"
98+
},
99+
getBody() {
100+
return (<PasswordReset role="body" ref="passwordResetForm"
97101
onChange={() => {
98102
this.setState({passwordValid: this.refs.passwordResetForm.isValid()});
99103
}} />);
100-
return this.props.useModal ? (
104+
},
105+
renderModal() {
106+
return (
101107
<Modal {...this.props.options} show={this.props.show} onHide={this.props.onClose}>
102108
<Modal.Header key="passwordChange" closeButton>
103109
<Modal.Title><Message msgId="user.changePwd"/></Modal.Title>
104110
</Modal.Header>
105111
<Modal.Body>
106-
{body}
112+
{this.getBody()}
107113
</Modal.Body>
108114
<Modal.Footer>
109-
{footer}
115+
{this.getFooter()}
110116
</Modal.Footer>
111-
</Modal>) : (
112-
<Dialog id="mapstore-changepassword-panel" style={assign({}, this.props.style, {display: this.props.show ? "block" : "none"})}>
117+
</Modal>);
118+
},
119+
renderDialog() {
120+
return (this.props.show) ? (<Dialog modal id="mapstore-changepassword-panel" style={assign({}, this.props.style, {display: "block"})}>
113121
<span role="header"><span className="changepassword-panel-title"><Message msgId="user.changePwd"/></span><button onClick={this.props.onClose} className="login-panel-close close">{this.props.closeGlyph ? <Glyphicon glyph={this.props.closeGlyph}/> : <span>×</span>}</button></span>
114-
{body}
115-
{footer}
116-
</Dialog>
117-
);
122+
{this.getBody()}
123+
{this.getFooter()}
124+
</Dialog>) : null;
125+
},
126+
render() {
127+
return this.props.useModal ? this.renderModal() : this.renderDialog();
118128
}
119129
});
120130

web/client/components/security/modals/UserDetailsModal.jsx

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55
* This source code is licensed under the BSD-style license found in the
66
* LICENSE file in the root directory of this source tree.
77
*/
8-
/**
9-
* Copyright 2016, GeoSolutions Sas.
10-
* All rights reserved.
11-
*
12-
* This source code is licensed under the BSD-style license found in the
13-
* LICENSE file in the root directory of this source tree.
14-
*/
15-
168
const React = require('react');
179

1810
const {Modal, Button, Table, Alert, Glyphicon} = require('react-bootstrap');
@@ -67,26 +59,31 @@ const UserDetails = React.createClass({
6759
}
6860
return <Alert type="info"><Message msgId="user.noAttributesMessage" /></Alert>;
6961
},
70-
render() {
71-
const footer = this.props.includeCloseButton ? <Button bsSize={this.props.buttonSize} bsSize="small" onClick={this.props.onClose}><Message msgId="close"/></Button> : <span/>;
72-
return this.props.useModal ? (
73-
<Modal {...this.props.options} show={this.props.show} onHide={this.props.onClose}>
62+
getFooter() {
63+
return (this.props.includeCloseButton ? <Button bsSize={this.props.buttonSize} bsSize="small" onClick={this.props.onClose}><Message msgId="close"/></Button> : <span/>);
64+
},
65+
renderModal() {
66+
return (<Modal {...this.props.options} show={this.props.show} onHide={this.props.onClose}>
7467
<Modal.Header key="details" closeButton>
75-
<Modal.Title>User Details</Modal.Title>
68+
<Modal.Title><Message msgId="user.details" /></Modal.Title>
7669
</Modal.Header>
7770
<Modal.Body>
7871
{this.renderAttributes()}
7972
</Modal.Body>
8073
<Modal.Footer>
81-
{footer}
74+
{this.getFooter()}
8275
</Modal.Footer>
83-
</Modal>) : (
84-
<Dialog id="mapstore-user-panel" style={assign({}, this.props.style, {display: this.props.show ? "block" : "none"})}>
85-
<span role="header"><span className="user-panel-title">Login</span><button onClick={this.props.onClose} className="login-panel-close close">{this.props.closeGlyph ? <Glyphicon glyph={this.props.closeGlyph}/> : <span>×</span>}</button></span>
86-
{this.renderAttributes()}
87-
{footer}
88-
</Dialog>
89-
);
76+
</Modal>);
77+
},
78+
renderDialog() {
79+
return (this.props.show) ? (<Dialog id="mapstore-user-panel" modal style={assign({}, this.props.style, {display: "block"})}>
80+
<span role="header"><span className="user-panel-title"><Message msgId="user.details" /></span><button onClick={this.props.onClose} className="login-panel-close close">{this.props.closeGlyph ? <Glyphicon glyph={this.props.closeGlyph}/> : <span>×</span>}</button></span>
81+
{this.renderAttributes()}
82+
{this.getFooter()}
83+
</Dialog>) : null;
84+
},
85+
render() {
86+
return this.props.useModal ? this.renderModal() : this.renderDialog();
9087
}
9188

9289
});

web/client/localConfig.json

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,25 @@
733733
"nav": false,
734734
"menuProps": {
735735
"noCaret": true
736-
}
737-
}
736+
},
737+
"toolsCfg": [{
738+
"buttonSize": "small",
739+
"includeCloseButton": false,
740+
"useModal": false,
741+
"closeGlyph": "1-close"
742+
}, {
743+
"buttonSize": "small",
744+
"includeCloseButton": false,
745+
"useModal": false,
746+
"closeGlyph": "1-close"
747+
}, {
748+
"buttonSize": "small",
749+
"includeCloseButton": false,
750+
"useModal": false,
751+
"closeGlyph": "1-close"
752+
}]
753+
754+
}
738755
}, {"name": "Language"}, {
739756
"name" : "Attribution",
740757
"hide": true

web/client/plugins/CreateNewMap.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const CreateNewMap = React.createClass({
3838

3939
render() {
4040
const display = this.props.isLoggedIn ? null : "none";
41-
return (<Grid fluid="true" style={{marginBottom: "30px", padding: 0, display}}>
41+
return (<Grid fluid={true} style={{marginBottom: "30px", padding: 0, display}}>
4242
<Col {...this.props.colProps} >
4343
<Button bsStyle="primary" onClick={() => { this.context.router.push("/viewer/" + this.props.mapType + "/new"); }}>
4444
<Message msgId="newMap" />

web/client/translations/data.en-US

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@
428428
"login": "Login",
429429
"logout": "Logout",
430430
"info": " Account Info",
431+
"details": " User Details",
431432
"noAttributesMessage": "There is no information related to your account",
432433
"changePwd": "Change Password",
433434
"newPwd": "New Password",

web/client/translations/data.fr-FR

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,8 @@
429429
"user":{
430430
"login": "Login",
431431
"logout": "Logout",
432-
"info": " Informations du compte",
432+
"info": "Informations du compte",
433+
"details": "Détails de l'utilisateur",
433434
"noAttributesMessage": "Il n'y a pas d'informations relatives à votre compte",
434435
"changePwd": "Changer le mot de passe",
435436
"newPwd": "Nouveau mot de passe",

web/client/translations/data.it-IT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@
428428
"login": "Login",
429429
"logout": "Logout",
430430
"info": " Informazioni Account",
431+
"details": " Dettagli utente",
431432
"noAttributesMessage": "Non ci sono informazioni sul tuo account",
432433
"changePwd": "Cambia Password",
433434
"newPwd": "Nuova Password",

0 commit comments

Comments
 (0)