Skip to content

Commit

Permalink
AUTHZ-1338 - Remove unneeded client option from password reset dialog…
Browse files Browse the repository at this point in the history
… and endpoint
  • Loading branch information
aarongodin committed Nov 26, 2019
1 parent 526a82c commit 31662cc
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 50 deletions.
4 changes: 1 addition & 3 deletions client/actions/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,13 +422,11 @@ export function cancelPasswordReset() {
export function resetPassword(application) {
return (dispatch, getState) => {
const { user: { user_id }, connection } = getState().passwordReset.toJS();
const clientId = application.client.value || application.client;
dispatch({
type: constants.PASSWORD_RESET,
payload: {
promise: axios.post(`/api/users/${user_id}/password-reset`, {
connection,
clientId
connection
})
},
meta: {
Expand Down
15 changes: 4 additions & 11 deletions client/containers/Users/Dialogs/PasswordResetDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ import { Error, Confirm } from 'auth0-extension-ui';

import submitForm from '../../../actions/submitForm';
import { userActions } from '../../../actions';
import getAppsForConnection from '../../../selectors/getAppsForConnection';
import getDialogMessage from './getDialogMessage';
import { getName, mapValues } from '../../../utils/display';
import {
useClientField,
useDisabledConnectionField,
useDisabledEmailField
} from '../../../utils/useDefaultFields';
Expand All @@ -22,7 +20,6 @@ export default connectContainer(class extends Component {
static stateToProps = (state) => ({
connections: state.connections,
passwordReset: state.passwordReset,
appsForConnection: getAppsForConnection(state),
settings: (state.settings.get('record') && state.settings.get('record').toJS().settings) || {},
languageDictionary: state.languageDictionary
});
Expand All @@ -36,15 +33,12 @@ export default connectContainer(class extends Component {
cancelPasswordReset: PropTypes.func.isRequired,
resetPassword: PropTypes.func.isRequired,
connections: PropTypes.object.isRequired,
passwordReset: PropTypes.object.isRequired,
appsForConnection: PropTypes.object
passwordReset: PropTypes.object.isRequired
};

shouldComponentUpdate(nextProps) {
return nextProps.passwordReset !== this.props.passwordReset ||
nextProps.languageDictionary !== this.props.languageDictionary ||
// nextProps.settings !== this.props.settings ||
nextProps.appsForConnection !== this.props.appsForConnection;
nextProps.languageDictionary !== this.props.languageDictionary
}

onConfirm = () => {
Expand Down Expand Up @@ -73,11 +67,10 @@ export default connectContainer(class extends Component {
getName(user, userFields, languageDictionary));

const fields = _.cloneDeep(userFields) || [];
useClientField(true, fields, this.props.appsForConnection.toJS());
useDisabledConnectionField(true, fields, connection, connections.get('records').toJS());
useDisabledEmailField(true, fields);

const allowedFields = ['email', 'client', 'connection'];
const allowedFields = ['email', 'connection'];
const filteredFields = _.filter(fields,
field => _.includes(allowedFields, field.property));

Expand All @@ -98,7 +91,7 @@ export default connectContainer(class extends Component {
{message}
</p>
<UserFieldsFormInstance
initialValues={mapValues(user, allowedFields, filteredFields, 'edit', languageDictionary, { applications: this.props.appsForConnection.toJS() })}
initialValues={mapValues(user, allowedFields, filteredFields, 'edit', languageDictionary)}
isEditForm={true}
fields={filteredFields}
languageDictionary={languageDictionary}
Expand Down
Loading

0 comments on commit 31662cc

Please sign in to comment.