X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Fuser-management%2Fsrc%2Fdashboard%2Fdashboard.jsx;h=c997e15bcfb8e262848742751133f0f0203594a2;hb=c637db2bc817cb1cd1a4a20655bf7e01b1c490bd;hp=fdac58b4023fd8f78c2523f3d153706659d04221;hpb=526b989da8b4a69f83eeb960ad844ac97b1933de;p=osm%2FUI.git diff --git a/skyquake/plugins/user-management/src/dashboard/dashboard.jsx b/skyquake/plugins/user-management/src/dashboard/dashboard.jsx index fdac58b40..c997e15bc 100644 --- a/skyquake/plugins/user-management/src/dashboard/dashboard.jsx +++ b/skyquake/plugins/user-management/src/dashboard/dashboard.jsx @@ -72,15 +72,21 @@ class UserManagementDashboard extends React.Component { viewUser = (un, index) => { this.actions.viewUser(un, index); } + editUser = () => { + this.actions.editUser(false); + } + cancelEditUser = () => { + this.actions.editUser(true) + } closePanel = () => { this.actions.handleCloseUserPanel(); } - updateUser = (e) => { - e.preventDefault(); - e.stopPropagation(); + // updateUser = (e) => { + // e.preventDefault(); + // e.stopPropagation(); - this.Store.updateUser(); - } + // this.Store.updateUser(); + // } deleteUser = (e) => { e.preventDefault(); e.stopPropagation(); @@ -102,6 +108,41 @@ class UserManagementDashboard extends React.Component { // 'confirm-password': this.state['confirm-password'] }); } + } + updateUser = (e) => { + let self = this; + e.preventDefault(); + e.stopPropagation(); + let validatedPasswords = validatePasswordFields(this.state); + if(validatedPasswords) { + this.Store.updateUser(_.merge({ + 'user-name': this.state['user-name'], + 'user-domain': this.state['user-domain'], + 'password': this.state['new-password'] + })); + } + function validatePasswordFields(state) { + let oldOne = state['old-password']; + let newOne = state['new-password']; + let confirmOne = state['confirm-password']; + if(true) { + if(oldOne == newOne) { + self.props.actions.showNotification('Your new password must not match your old one'); + return false; + } + if(newOne != confirmOne) { + self.props.actions.showNotification('Passwords do not match'); + return false; + } + return { + // 'old-password': oldOne, + 'new-password': newOne, + 'confirm-password': confirmOne + } + } else { + return {}; + } + } } evaluateSubmit = (e) => { if (e.keyCode == 13) { @@ -118,11 +159,59 @@ class UserManagementDashboard extends React.Component { this.actions.handleHideColumns(e); console.log('transition end') } + disableChange = (e) => { + let value = e.target.value; + value = value.toUpperCase(); + if (value=="TRUE") { + value = true; + } else { + value = false; + } + console.log(value) + } render() { let self = this; let html; let props = this.props; let state = this.state; + let passwordSectionHTML = null; + let formButtonsHTML = ( + +