Complete change password functionality
This commit is contained in:
@@ -12,7 +12,8 @@ import {
|
||||
SET_FORM_EMAIL,
|
||||
SET_FORM_PASSWORD,
|
||||
SET_FORM_PASSWORD_CONFIRMATION,
|
||||
SET_FORM_EMAIL_VERIFICATION
|
||||
SET_FORM_EMAIL_VERIFICATION,
|
||||
SET_FORM_OLD_PASSWORD
|
||||
} from "../../constants/auth.constants";
|
||||
import { parseError } from "../common.actions";
|
||||
|
||||
@@ -41,6 +42,22 @@ export function setAuthRequestError(exception) {
|
||||
error["Non Field Errors"] = error.non_field_errors;
|
||||
delete error["non_field_errors"];
|
||||
}
|
||||
if (error.detail) {
|
||||
error["Detail"] = error.detail;
|
||||
delete error["detail"];
|
||||
}
|
||||
if (error.old_password) {
|
||||
error["Old Password"] = error.old_password;
|
||||
delete error["old_password"];
|
||||
}
|
||||
if (error.new_password1) {
|
||||
error["New Password"] = error.new_password1;
|
||||
delete error["new_password1"];
|
||||
}
|
||||
if (error.new_password2) {
|
||||
error["Confirm New Password"] = error.new_password2;
|
||||
delete error["new_password2"];
|
||||
}
|
||||
|
||||
return {
|
||||
type: SET_AUTH_REQUEST_ERROR,
|
||||
@@ -137,3 +154,10 @@ export function setFormEmailVerification(emailKey) {
|
||||
data: emailKey
|
||||
};
|
||||
}
|
||||
|
||||
export function setFormOldPassword(oldPassword) {
|
||||
return {
|
||||
type: SET_FORM_OLD_PASSWORD,
|
||||
data: oldPassword
|
||||
};
|
||||
}
|
||||
|
@@ -2,7 +2,8 @@ import {
|
||||
SEND_REGISTER_REQUEST,
|
||||
SEND_EMAIL_VERIFICATION_REQUEST,
|
||||
SEND_LOGIN_REQUEST,
|
||||
SEND_LOGOUT_REQUEST
|
||||
SEND_LOGOUT_REQUEST,
|
||||
SEND_CHANGE_PASSWORD_REQUEST
|
||||
} from "../../constants/auth.constants";
|
||||
|
||||
export function sendRegisterRequest(postBody) {
|
||||
@@ -31,3 +32,10 @@ export function sendLogoutRequest() {
|
||||
type: SEND_LOGOUT_REQUEST
|
||||
}
|
||||
}
|
||||
|
||||
export function sendChangePasswordRequest(postBody) {
|
||||
return {
|
||||
type: SEND_CHANGE_PASSWORD_REQUEST,
|
||||
data: postBody
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user