Skip to content
Snippets Groups Projects
Commit 53f6db27 authored by Shane Tomlinson's avatar Shane Tomlinson
Browse files

We can now show all email addresses, including certs

parent c7b51f71
No related branches found
No related tags found
No related merge requests found
/*globals: BrowserIDNetwork: true */
/*globals BrowserIDNetwork: true, BrowserIDIdentities: true, _: true, confirm: true, getEmails: true, display_saved_ids: true, displayEmails: true*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
......@@ -33,72 +33,78 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
(function() {
"use strict";
$(function() {
BrowserIDNetwork.checkAuth(function(authenticated) {
if (authenticated) {
$("body").addClass("authenticated");
if ($('#emailList').length) {
display_saved_ids();
$(function() {
BrowserIDNetwork.checkAuth(function(authenticated) {
if (authenticated) {
$("body").addClass("authenticated");
if ($('#emailList').length) {
display_saved_ids();
}
}
}
});
});
});
function display_saved_ids()
{
var emails = {};
BrowserIDIdentities.syncIdentities(function() {
emails = getEmails();
displayEmails();
});
function display_saved_ids()
{
var emails = {};
BrowserIDIdentities.syncIdentities(function() {
emails = getEmails();
displayEmails();
});
function displayEmails() {
$('#cancellink').click(function() {
if (confirm('Are you sure you want to cancel your account?')) {
BrowserIDNetwork.cancelUser(function() {
document.location="/";
});
}
});
function displayEmails() {
$('#cancellink').click(function() {
if (confirm('Are you sure you want to cancel your account?')) {
BrowserIDNetwork.cancelUser(function() {
document.location="/";
});
}
});
$("#emailList").empty();
_(emails).each(function(data, e) {
var block = $("<div>").addClass("emailblock");
var label = $("<div>").addClass("email").text(e);
var meta = $("<div>").addClass("meta");
$("#emailList").empty();
_(emails).each(function(data, e) {
var block = $("<div>").addClass("emailblock");
var label = $("<div>").addClass("email").text(e);
var meta = $("<div>").addClass("meta");
var pub = $("<div class='keyblock'>").text(data.pub);
pub.hide();
var linkblock = $("<div>");
var puba = $("<a>").text("[show public key]");
// var priva = $("<a>").text("[show private key]");
puba.click(function() {pub.show()});
// priva.click(function() {priv.show()});
linkblock.append(puba);
// linkblock.append(" / ");
// linkblock.append(priva);
var deauth = $("<button>").text("Forget this Email");
meta.append(deauth);
deauth.click(function() {
// remove email from server
BrowserIDNetwork.removeEmail(e, display_saved_ids);
});
var d = new Date(data.created);
var datestamp = $("<div class='date'>").text("Signed in at " + d.toLocaleString());
var pub = $("<div class='keyblock'>").hide();
var keyText = data.pub.value;
pub.text(keyText);
meta.append(datestamp);
meta.append(linkblock);
block.append(label);
block.append(meta);
// block.append(priv);
block.append(pub);
var linkblock = $("<div>");
var puba = $("<a>").text("[show public key]");
// var priva = $("<a>").text("[show private key]");
puba.click(function() {pub.show();});
// priva.click(function() {priv.show()});
linkblock.append(puba);
// linkblock.append(" / ");
// linkblock.append(priva);
var deauth = $("<button>").text("Forget this Email");
meta.append(deauth);
deauth.click(function() {
// remove email from server
BrowserIDNetwork.removeEmail(e, display_saved_ids);
});
$("#emailList").append(block);
});
var d = new Date(data.created);
var datestamp = $("<div class='date'>").text("Signed in at " + d.toLocaleString());
meta.append(datestamp);
meta.append(linkblock);
block.append(label);
block.append(meta);
// block.append(priv);
block.append(pub);
$("#emailList").append(block);
});
}
}
}
}());
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment