Commit bc4c531f authored by Birin Sanchez's avatar Birin Sanchez
Browse files

use user.get_identity() rather than user.username when checking if


recovery email is already used in WC.
Signed-off-by: Birin Sanchez's avatarBirin Sanchez <birin.sanchez@puri.sm>
parent 43c7d408
Pipeline #20278 passed with stage
in 29 seconds
......@@ -111,8 +111,8 @@ class ProfileConfigureForm(forms.ModelForm):
query = "customers?role=all&limit=1&email=" + new_eml
woo_response = woo.get(query)
total_emails = int(woo_response.headers['X-WP-Total'])
if total_emails > 1 or \
(total_emails == 1 and woo_response.json()[0]['username'] != self.user.username):
if total_emails > 1 or \
(total_emails == 1 and woo_response.json()[0]['username'] != self.user.get_identity()):
raise ValidationError(_('Sorry, that email is already in use.'), code='already_taken')
return new_eml
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment