diff --git a/flask/auth.py b/flask/auth.py index 40bc8a15..4f434d97 100644 --- a/flask/auth.py +++ b/flask/auth.py @@ -133,6 +133,7 @@ def signup(): "uuid": uuid, "loggedCount": 1, "isverified": False, + "newemail":'', } if not registry_user: @@ -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 diff --git a/flask/packages.py b/flask/packages.py index b8846e2f..156a5842 100644 --- a/flask/packages.py +++ b/flask/packages.py @@ -16,7 +16,7 @@ import math import semantic_version from license_expression import get_spdx_licensing -import validate_package +# import validate_package parameters = { diff --git a/registry/src/pages/account.js b/registry/src/pages/account.js index 8e061737..09525efd 100644 --- a/registry/src/pages/account.js +++ b/registry/src/pages/account.js @@ -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(); diff --git a/registry/src/store/actions/accountActions.js b/registry/src/store/actions/accountActions.js index db563642..e00d8c80 100644 --- a/registry/src/store/actions/accountActions.js +++ b/registry/src/store/actions/accountActions.js @@ -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"; @@ -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({ diff --git a/registry/src/store/reducers/accountReducer.js b/registry/src/store/reducers/accountReducer.js index e057f5bb..aa34194e 100644 --- a/registry/src/store/reducers/accountReducer.js +++ b/registry/src/store/reducers/accountReducer.js @@ -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 = { @@ -12,6 +15,7 @@ const initialState = { email: "", dateJoined: "", isLoading: true, + isLoadingEmail: false, message: null, resetPasswordSuccessMsg: null, }; @@ -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,