Skip to content

Commit

Permalink
fix: mail
Browse files Browse the repository at this point in the history
  • Loading branch information
henilp105 committed Jun 15, 2023
1 parent 40f4b9f commit cae240a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
5 changes: 4 additions & 1 deletion flask/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def signup():
"uuid": uuid,
"loggedCount": 1,
"isverified": False,
"newemail":'',
}

if not registry_user:
Expand Down Expand Up @@ -276,7 +277,9 @@ def forgot_password(*email):


def send_verify_email(email):
user = db.users.find_one({"email": email})
query = {"$and": [{"$or": [{"email": email}, {"newemail": email}]}]}

user = db.users.find_one(query)

if not user:
return jsonify({"message": "User not found", "code": 404}), 404
Expand Down
2 changes: 1 addition & 1 deletion flask/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import math
import semantic_version
from license_expression import get_spdx_licensing
import validate_package
# import validate_package


parameters = {
Expand Down
2 changes: 1 addition & 1 deletion registry/src/pages/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Account = () => {
const username = useSelector((state) => state.auth.username);
const uuid = useSelector((state) => state.auth.uuid);
const isLoading = useSelector((state) => state.account.isLoading);
const isLoadingEmail = useSelector((state) => state.account.isLoading);
const isLoadingEmail = useSelector((state) => state.account.isLoadingEmail);
const dispatch = useDispatch();
const navigate = useNavigate();

Expand Down
2 changes: 2 additions & 0 deletions registry/src/store/actions/accountActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import axios from "axios";

export const RESET_SUCCESS = "RESET_SUCCESS";
export const RESET_FAILURE = "RESET_FAILURE";
export const CHANGE_EMAIL = "CHANGE_EMAIL";
export const CHANGE_EMAIL_FAILURE = "CHANGE_EMAIL_FAILURE";
export const CHANGE_EMAIL_SUCCESS = "CHANGE_EMAIL_SUCCESS";
export const GET_USER_ACCOUNT = "GET_USER_ACCOUNT";
Expand Down Expand Up @@ -71,6 +72,7 @@ export const change = (newemail, uuid) => async (dispatch) => {
let formData = new FormData();
formData.append("newemail", newemail);
formData.append("uuid", uuid);
dispatch({ type: CHANGE_EMAIL });

try {
const result = await axios({
Expand Down
24 changes: 18 additions & 6 deletions registry/src/store/reducers/accountReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import {
GET_USER_ACCOUNT,
RESET_PASSWORD_ERROR,
RESET_PASSWORD,
RESET_MESSAGES,CHANGE_EMAIL_SUCCESS,CHANGE_EMAIL_FAILURE
RESET_MESSAGES,
CHANGE_EMAIL_SUCCESS,
CHANGE_EMAIL_FAILURE,
CHANGE_EMAIL,
} from "../actions/accountActions";

const initialState = {
Expand All @@ -12,6 +15,7 @@ const initialState = {
email: "",
dateJoined: "",
isLoading: true,
isLoadingEmail: false,
message: null,
resetPasswordSuccessMsg: null,
};
Expand All @@ -34,12 +38,20 @@ const accountReducer = (state = initialState, action) => {
return {
...state,
message: action.payload,
isLoadingEmail: false,
};
case CHANGE_EMAIL:
return {
...state,
message: action.payload,
isLoadingEmail: true,
};
case CHANGE_EMAIL_FAILURE:
return {
...state,
message: action.payload,
isLoadingEmail: false,
};
case CHANGE_EMAIL_FAILURE:
return {
...state,
message: action.payload,
};
case RESET_PASSWORD_ERROR:
return {
...state,
Expand Down

0 comments on commit cae240a

Please sign in to comment.