Remove unnecessary email generation in OAuth login

Handled by the `emaIl_required` flag already
This commit is contained in:
Joseph Schorr 2017-02-01 14:32:57 -05:00
parent c8e5eb5ad1
commit c6b0376d61

View file

@ -1,5 +1,4 @@
import logging
import uuid
from flask import request, redirect, url_for, Blueprint
from peewee import IntegrityError
@ -60,16 +59,12 @@ def _conduct_oauth_login(service_id, service_name, user_id, username, email, met
new_username = valid
break
# Generate a valid email. If the email is None and the MAILING feature is turned
# off, simply place in a fake email address.
if email is None and not features.MAILING:
email = '%s@fake.example.com' % (str(uuid.uuid4()))
prompts = model.user.get_default_user_prompts(features)
to_login = model.user.create_federated_user(new_username, email, service_id,
user_id, set_password_notification=True,
metadata=metadata or {},
prompts=prompts)
prompts=prompts,
email_required=features.MAILING)
# Success, tell analytics
analytics.track(to_login.username, 'register', {'service': service_name.lower()})