From 13298be5d3a2c15b001631c15ae46483a7415904 Mon Sep 17 00:00:00 2001 From: yackob03 Date: Tue, 15 Oct 2013 01:12:23 -0400 Subject: [PATCH] Move the register code for github login to the actual registration part, not just login. --- endpoints/web.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/endpoints/web.py b/endpoints/web.py index a44c2da11..604255f36 100644 --- a/endpoints/web.py +++ b/endpoints/web.py @@ -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