can now add and remove email address claims from the UI
parent
1ad1813239
commit
6e095e3266
|
@ -214,7 +214,7 @@ var ClaimListView = Backbone.View.extend({
|
||||||
events:{
|
events:{
|
||||||
'click .btn-save':'savePolicy',
|
'click .btn-save':'savePolicy',
|
||||||
'click .btn-cancel':'cancel',
|
'click .btn-cancel':'cancel',
|
||||||
'click .btn-share':'addClaim'
|
'click #add-email':'addClaim'
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel:function(e) {
|
cancel:function(e) {
|
||||||
|
@ -252,6 +252,28 @@ var ClaimListView = Backbone.View.extend({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
addClaim:function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// post to the webfinger helper and get the response back
|
||||||
|
|
||||||
|
var _self = this;
|
||||||
|
|
||||||
|
var email = $('#email', this.el).val();
|
||||||
|
|
||||||
|
var base = $('base').attr('href');
|
||||||
|
$.getJSON(base + '/api/emailsearch?' + $.param({'identifier': email}), function(data) {
|
||||||
|
|
||||||
|
var claim = new ClaimModel(data);
|
||||||
|
_self.model.add(claim, {'trigger': false});
|
||||||
|
_self.render();
|
||||||
|
|
||||||
|
}).error(function(jqXHR, textStatus, errorThrown) {
|
||||||
|
console.log(errorThrown);
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
togglePlaceholder:function() {
|
togglePlaceholder:function() {
|
||||||
if (this.model.length > 0) {
|
if (this.model.length > 0) {
|
||||||
$('#required-claim-table', this.el).show();
|
$('#required-claim-table', this.el).show();
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class UserClaimSearchHelper {
|
||||||
|
|
||||||
if (localUser != null) {
|
if (localUser != null) {
|
||||||
Map<String, Object> entity = new HashMap<>();
|
Map<String, Object> entity = new HashMap<>();
|
||||||
entity.put("issuers", ImmutableSet.of(config.getIssuer()));
|
entity.put("issuer", ImmutableSet.of(config.getIssuer()));
|
||||||
entity.put("name", "email");
|
entity.put("name", "email");
|
||||||
entity.put("value", localUser.getEmail());
|
entity.put("value", localUser.getEmail());
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ public class UserClaimSearchHelper {
|
||||||
if (resp != null && resp.getIssuer() != null) {
|
if (resp != null && resp.getIssuer() != null) {
|
||||||
// we found an issuer, return that
|
// we found an issuer, return that
|
||||||
Map<String, Object> entity = new HashMap<>();
|
Map<String, Object> entity = new HashMap<>();
|
||||||
entity.put("issuers", ImmutableSet.of(resp.getIssuer()));
|
entity.put("issuer", ImmutableSet.of(resp.getIssuer()));
|
||||||
entity.put("name", "email");
|
entity.put("name", "email");
|
||||||
entity.put("value", email);
|
entity.put("value", email);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue