%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/emergentqj/actioncivile/pre-auth/.8352c036a19b0051d0217d27d25e3f4a/static/js/containers/ForgotPassword/
Upload File :
Create Path :
Current File : /home/emergentqj/actioncivile/pre-auth/.8352c036a19b0051d0217d27d25e3f4a/static/js/containers/ForgotPassword/ResetPasswordContainer.js

import { connect } from "react-redux";

import { trackMixpanelActions } from "utils";
import MIXPANEL_ACTIONS from "constants/mixpanel_actions";

import ResetPasswordForm from "../../components/ForgotPassword/ResetPasswordForm";
import {
  resetPassword,
  resetPasswordToken,
} from "../../actions/list_actions";

const mapStateToProps = (state) => {
  const resetPasswordForm = state.form.resetPasswordForm
    ? state.form.resetPasswordForm
    : null;
  return {
    resetPasswordForm,
    phone: state.resetPassword.get("phoneNumber"),
    token: state.resetPassword.get("token"),
    fullToken: state.resetPassword.get("fullToken"),
    newPassword:
      resetPasswordForm && resetPasswordForm.values
        ? resetPasswordForm.values.rpass
        : null,
    pswValidationMsg: state.resetPassword.get("pswValidationMsg"),
    showPassword: state.resetPassword.get("showPassword"),
    showPasswordConfirmation: state.resetPassword.get(
      "showPasswordConfirmation",
    ),
    isOpenedWithToken: state.resetPassword.get("isOpenedWithToken"),
  };
};

const mapDispatchToProps = (dispatch) => ({
  resetPasswordToken: (
    phone,
    token,
    newPassword,
    fullToken,
    isOpenedWithToken,
  ) => {
    trackMixpanelActions(MIXPANEL_ACTIONS.FORGOT_PASSWORD_NEW_SET, {
      category: "Selfservice",
      channel: "DesktopWeb",
      eventType: "forgotPassword",
      label: MIXPANEL_ACTIONS.FORGOT_PASSWORD_NEW_SET,
    });

    if (isOpenedWithToken) {
      dispatch(resetPasswordToken(fullToken, newPassword));
    } else {
      dispatch(resetPassword(phone, token, newPassword));
    }
  },
});

export default connect(
  mapStateToProps,
  mapDispatchToProps,
)(ResetPasswordForm);

Zerion Mini Shell 1.0