Skip to content

Commit 23c83c1

Browse files
uds5501iamareebjamal
authored andcommitted
fix: handle padding error for verification token (#6206)
* handle padding error * catch specific base64 error
1 parent 7b54d2a commit 23c83c1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/api/auth.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ def login_user(provider):
174174

175175
@auth_routes.route('/verify-email', methods=['POST'])
176176
def verify_email():
177-
token = base64.b64decode(request.json['data']['token'])
177+
try:
178+
token = base64.b64decode(request.json['data']['token'])
179+
except base64.binascii.Error:
180+
return BadRequestError({'source': ''}, 'Invalid Token').respond()
178181
s = get_serializer()
179182

180183
try:

0 commit comments

Comments
 (0)