Move the register code for github login to the actual registration part, not just login.

This commit is contained in:
yackob03 2013-10-15 01:12:23 -04:00
parent 6d33b2af59
commit 13298be5d3

View file

@ -128,22 +128,22 @@ def github_oauth_callback():
to_login = model.verify_federated_login('github', github_id)
if not to_login:
# try to create the user
try:
to_login = model.create_federated_user(username, found_email, 'github',
github_id)
# Success, tell mixpanel
mixpanel.track(to_login.username, 'register', {'service': 'github'})
state = request.args.get('state', None)
if state:
logger.debug('Aliasing with state: %s' % state)
mixpanel.alias(to_login.username, state)
except model.DataModelException, ex:
return render_template('githuberror.html', error_message=ex.message)
if common_login(to_login):
# Success
mixpanel.track(to_login.username, 'register', {'service': 'github'})
state = request.args.get('state', None)
if state:
logger.debug('Aliasing with state: %s' % state)
mixpanel.alias(to_login.username, state)
return redirect(url_for('index'))
# TODO something bad happened, we need to tell the user somehow