diff --git a/endpoints/web.py b/endpoints/web.py index 6f170cbdc..41a669d58 100644 --- a/endpoints/web.py +++ b/endpoints/web.py @@ -7,7 +7,7 @@ from flask.ext.login import login_user, UserMixin, login_required, logout_user from flask.ext.principal import identity_changed, Identity, AnonymousIdentity from data import model -from app import app, login_manager +from app import app, login_manager, mixpanel logger = logging.getLogger(__name__) @@ -143,6 +143,14 @@ def github_oauth_callback(): 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 diff --git a/static/js/controllers.js b/static/js/controllers.js index 0fbe4c911..57eacb213 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -141,6 +141,11 @@ function LandingCtrl($scope, $timeout, Restangular, UserService, KeyService) { $scope.user = currentUser; }, true); + angulartics.waitForVendorApi(mixpanel, 500, function(loadedMixpanel) { + var mixpanelId = loadedMixpanel.get_distinct_id(); + $scope.github_state_clause = '&state=' + mixpanelId; + }); + $scope.githubClientId = KeyService.githubClientId; $scope.awaitingConfirmation = false; diff --git a/static/partials/landing.html b/static/partials/landing.html index 999e580eb..6e1e10029 100644 --- a/static/partials/landing.html +++ b/static/partials/landing.html @@ -47,7 +47,7 @@ OR - Sign In with GitHub + Sign In with GitHub

No credit card required.

diff --git a/templates/signin.html b/templates/signin.html index 4b14b6dcb..4a107a9c3 100644 --- a/templates/signin.html +++ b/templates/signin.html @@ -7,7 +7,17 @@ + + + +
@@ -20,7 +30,7 @@ OR - Sign In with GitHub + Sign In with GitHub
{% if invalid_credentials %} @@ -31,5 +41,19 @@
You must verify your email address before you can sign in.
{% endif %}
+ + \ No newline at end of file