This repository has been archived by the owner on Jan 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from peterbe/revert-django-browserid-0.7.1
Revert "upgrade to django-browserid==0.7.1"
- Loading branch information
Showing
86 changed files
with
609 additions
and
15,120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,15 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
(function($) { | ||
'use strict'; | ||
|
||
$(function() { | ||
// State? Ewwwwww. | ||
var logoutButton = null; | ||
var requestOptions = [ | ||
'siteName', | ||
'siteLogo', | ||
'oncancel', | ||
'privacyPolicy', | ||
'returnTo', | ||
'termsOfService' | ||
]; | ||
|
||
$(document).delegate('.browserid-login, #browserid', 'click', function(e) { | ||
e.preventDefault(); | ||
|
||
// Arguments to navigator.id.request can be specified by data-attributes | ||
// on the BrowserID link: <a href="#" data-site-name="Site Name"> | ||
var options = {}; | ||
var $link = $(e.target); | ||
for (var k = 0; k < requestOptions.length; k++) { | ||
var name = requestOptions[k]; | ||
var value = $link.data(name); | ||
if (value !== undefined) { | ||
options[name] = value; | ||
} | ||
} | ||
|
||
navigator.id.request(options); // Triggers BrowserID login dialog. | ||
}); | ||
|
||
$('.browserid-logout').bind('click', function(e) { | ||
e.preventDefault(); | ||
logoutButton = e.target; | ||
navigator.id.logout(); // Clears User Agent BrowserID state. | ||
}); | ||
|
||
navigator.id.watch({ | ||
onlogin: function(assertion) { | ||
// Don't bother if login just failed. | ||
if (location.search.indexOf('bid_login_failed=1') !== -1) { | ||
navigator.id.logout(); | ||
} else if (assertion) { | ||
var $e = $('#id_assertion'); | ||
$e.val(assertion.toString()); | ||
$e.parent().submit(); | ||
} | ||
}, | ||
|
||
onlogout: function() { | ||
var currentButton = logoutButton; | ||
if (currentButton !== null) { | ||
logoutButton = null; | ||
if (currentButton.href) { | ||
window.location = currentButton.href; | ||
} | ||
} | ||
$(document).ready(function() { | ||
$('#browserid').bind('click', function(e) { | ||
e.preventDefault(); | ||
navigator.id.getVerifiedEmail(function(assertion) { | ||
if (assertion) { | ||
var $e = $('#id_assertion'); | ||
$e.val(assertion.toString()); | ||
$e.parent().submit(); | ||
} | ||
}); | ||
}); | ||
})(jQuery); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.