Skip to content

Commit

Permalink
Merge pull request #1645 from mstriemer/notify-fxa-of-migration-1614
Browse files Browse the repository at this point in the history
Send migration=amo to FxA when migrating (fixes #1614)
  • Loading branch information
mstriemer committed Feb 9, 2016
2 parents a61be13 + c9a88fc commit 5959732
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3,049 deletions.
1 change: 0 additions & 1 deletion src/olympia/lib/settings_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,6 @@ def JINJA_CONFIG():
),
'fxa': [
'js/lib/uri.js',
'js/lib/fxa-relier-client.js',
'js/common/fxa-login.js',
],
'zamboni/discovery': (
Expand Down
19 changes: 8 additions & 11 deletions static/js/common/fxa-login.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
(function() {
var config = $('body').data('fxa-config');
var fxaClient = new FxaRelierClient(config.clientId, {
contentHost: config.contentHost,
oauthHost: config.oauthHost,
});

function nextPath() {
var to = new Uri(location).getQueryParamValue('to');
Expand Down Expand Up @@ -35,23 +31,24 @@
function fxaLogin(opts) {
opts = opts || {};
var authConfig = {
action: 'signin',
client_id: config.clientId,
email: opts.email || config.email,
state: config.state + ':' + urlsafe(btoa(nextPath())),
redirectUri: config.redirectUrl,
scope: config.scope,
};
if (opts.signUp) {
console.log('[FxA] Starting register');
return fxaClient.auth.signUp(authConfig);
} else {
console.log('[FxA] Starting login');
return fxaClient.auth.signIn(authConfig);
if (opts.migration) {
authConfig.migration = 'amo';
}
var url = config.oauthHost + '/authorization?' + $.param(authConfig);
console.log('[FxA] Starting login', url);
location.href = url;
}

$('body').on('click', '.fxa-login', function(e) {
e.preventDefault();
fxaLogin();
fxaLogin({migration: true});
});

function showLoginForm($form) {
Expand Down

0 comments on commit 5959732

Please sign in to comment.