From c57968b7c0fe86a33e7b97aea82432500a29ebe1 Mon Sep 17 00:00:00 2001 From: jain Date: Fri, 30 Jun 2023 11:17:18 +0530 Subject: [PATCH] reset password msg --- account/serializers.py | 2 ++ base/messages.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/account/serializers.py b/account/serializers.py index 5f03fc2..36571dc 100644 --- a/account/serializers.py +++ b/account/serializers.py @@ -72,6 +72,8 @@ class ResetPasswordSerializer(serializers.Serializer): if user_opt_details: user_details = User.objects.filter(email=user_opt_details.email).last() if user_details: + if user_details.check_password(password): + raise serializers.ValidationError({"details":ERROR_CODE['2001'],"code":"400", "status":"failed"}) user_details.set_password(password) user_details.save() return {'password':password} diff --git a/base/messages.py b/base/messages.py index f977ee7..7d48f97 100644 --- a/base/messages.py +++ b/base/messages.py @@ -24,7 +24,7 @@ ERROR_CODE_REQUIRED = { # Error code ERROR_CODE = { "2000": "Email not found.", - "2001": "Your account has not been verified. Please check your email and verify it.", + "2001": "This is your existing password. Please choose other one", "2002": "Invalid login credentials.", "2003": "An account already exists with this email address.", "2004": "User not found.",