|
|
|
|
@ -23,6 +23,14 @@ def random_pass(): |
|
|
|
|
return ''.join(password) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_email(strategy, details, response, *args, **kwargs): |
|
|
|
|
if not details.get('email'): |
|
|
|
|
email = response.get('email') |
|
|
|
|
if email: |
|
|
|
|
details['email'] = email |
|
|
|
|
return {'details': details} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def load_user(strategy, details, response, uid, *args, **kwargs): |
|
|
|
|
user = None |
|
|
|
|
if details.get('email'): |
|
|
|
|
@ -54,7 +62,11 @@ def require_email(strategy, details, user=None, is_new=False, *args, **kwargs): |
|
|
|
|
return |
|
|
|
|
elif is_new and not details.get('email'): |
|
|
|
|
email = strategy.request_data().get('email') |
|
|
|
|
if email and not User.objects.filter(email=email).exists(): |
|
|
|
|
import pdb; pdb.set_trace() |
|
|
|
|
if not email: |
|
|
|
|
strategy.request.session['new_email'] = True |
|
|
|
|
return redirect('acquire_email') |
|
|
|
|
elif email and not User.objects.filter(email=email).exists(): |
|
|
|
|
details['email'] = email |
|
|
|
|
else: |
|
|
|
|
strategy.request.session['new_email'] = True |
|
|
|
|
|