cleaned up contacts handling across all classes of client, added text to address #626
parent
04acc21eea
commit
112154a2d8
|
@ -530,6 +530,12 @@ var AppRouter = Backbone.Router.extend({
|
||||||
var view = new ClientFormView({model:client, systemScopeList: this.systemScopeList});
|
var view = new ClientFormView({model:client, systemScopeList: this.systemScopeList});
|
||||||
view.load(function() {
|
view.load(function() {
|
||||||
// set up this new client to require a secret and have us autogenerate one
|
// set up this new client to require a secret and have us autogenerate one
|
||||||
|
var userInfo = getUserInfo();
|
||||||
|
var contacts = [];
|
||||||
|
if (userInfo != null && userInfo.email != null) {
|
||||||
|
contacts.push(userInfo.email);
|
||||||
|
}
|
||||||
|
|
||||||
client.set({
|
client.set({
|
||||||
tokenEndpointAuthMethod: "SECRET_BASIC",
|
tokenEndpointAuthMethod: "SECRET_BASIC",
|
||||||
generateClientSecret:true,
|
generateClientSecret:true,
|
||||||
|
@ -541,7 +547,8 @@ var AppRouter = Backbone.Router.extend({
|
||||||
idTokenValiditySeconds:600,
|
idTokenValiditySeconds:600,
|
||||||
grantTypes: ["authorization_code"],
|
grantTypes: ["authorization_code"],
|
||||||
responseTypes: ["code"],
|
responseTypes: ["code"],
|
||||||
subjectType: "PUBLIC"
|
subjectType: "PUBLIC",
|
||||||
|
contacts: contacts
|
||||||
}, { silent: true });
|
}, { silent: true });
|
||||||
|
|
||||||
|
|
||||||
|
@ -903,6 +910,12 @@ var AppRouter = Backbone.Router.extend({
|
||||||
|
|
||||||
view.load(function() {
|
view.load(function() {
|
||||||
|
|
||||||
|
var userInfo = getUserInfo();
|
||||||
|
var contacts = [];
|
||||||
|
if (userInfo != null && userInfo.email != null) {
|
||||||
|
contacts.push(userInfo.email);
|
||||||
|
}
|
||||||
|
|
||||||
client.set({
|
client.set({
|
||||||
require_auth_time:true,
|
require_auth_time:true,
|
||||||
default_max_age:60000,
|
default_max_age:60000,
|
||||||
|
@ -910,7 +923,8 @@ var AppRouter = Backbone.Router.extend({
|
||||||
token_endpoint_auth_method: 'client_secret_basic',
|
token_endpoint_auth_method: 'client_secret_basic',
|
||||||
grant_types: ["authorization_code"],
|
grant_types: ["authorization_code"],
|
||||||
response_types: ["code"],
|
response_types: ["code"],
|
||||||
subject_type: "public"
|
subject_type: "public",
|
||||||
|
contacts: contacts
|
||||||
}, { silent: true });
|
}, { silent: true });
|
||||||
|
|
||||||
$('#content').html(view.render().el);
|
$('#content').html(view.render().el);
|
||||||
|
@ -968,9 +982,16 @@ var AppRouter = Backbone.Router.extend({
|
||||||
|
|
||||||
view.load(function() {
|
view.load(function() {
|
||||||
|
|
||||||
|
var userInfo = getUserInfo();
|
||||||
|
var contacts = [];
|
||||||
|
if (userInfo != null && userInfo.email != null) {
|
||||||
|
contacts.push(userInfo.email);
|
||||||
|
}
|
||||||
|
|
||||||
client.set({
|
client.set({
|
||||||
scope: _.uniq(_.flatten(app.systemScopeList.defaultDynRegScopes().pluck("value"))).join(" "),
|
scope: _.uniq(_.flatten(app.systemScopeList.defaultDynRegScopes().pluck("value"))).join(" "),
|
||||||
token_endpoint_auth_method: 'client_secret_basic',
|
token_endpoint_auth_method: 'client_secret_basic',
|
||||||
|
contacts: contacts
|
||||||
}, { silent: true });
|
}, { silent: true });
|
||||||
|
|
||||||
$('#content').html(view.render().el);
|
$('#content').html(view.render().el);
|
||||||
|
|
|
@ -129,12 +129,21 @@ var DynRegRootView = Backbone.View.extend({
|
||||||
|
|
||||||
client.fetch({success: function() {
|
client.fetch({success: function() {
|
||||||
|
|
||||||
|
var userInfo = getUserInfo();
|
||||||
|
var contacts = client.get("contacts");
|
||||||
|
if (userInfo != null && userInfo.email != null && ! _.contains(contacts, userInfo.email)) {
|
||||||
|
contacts.push(userInfo.email);
|
||||||
|
}
|
||||||
|
client.set({
|
||||||
|
contacts: contacts
|
||||||
|
}, { silent: true });
|
||||||
|
|
||||||
var view = new DynRegEditView({model: client, systemScopeList: app.systemScopeList});
|
var view = new DynRegEditView({model: client, systemScopeList: app.systemScopeList});
|
||||||
|
|
||||||
view.load(function() {
|
view.load(function() {
|
||||||
$('#content').html(view.render().el);
|
$('#content').html(view.render().el);
|
||||||
view.delegateEvents();
|
view.delegateEvents();
|
||||||
setPageTitle("Dynamically Register a New Client");
|
setPageTitle("Edit a Dynamically Registered Client");
|
||||||
app.navigate('dev/dynreg/edit', {trigger: true});
|
app.navigate('dev/dynreg/edit', {trigger: true});
|
||||||
self.remove();
|
self.remove();
|
||||||
});
|
});
|
||||||
|
@ -383,6 +392,16 @@ var DynRegEditView = Backbone.View.extend({
|
||||||
// switch to an "edit" view
|
// switch to an "edit" view
|
||||||
app.navigate('dev/dynreg/edit', {trigger: true});
|
app.navigate('dev/dynreg/edit', {trigger: true});
|
||||||
_self.remove();
|
_self.remove();
|
||||||
|
|
||||||
|
var userInfo = getUserInfo();
|
||||||
|
var contacts = _self.model.get("contacts");
|
||||||
|
if (userInfo != null && userInfo.email != null && ! _.contains(contacts, userInfo.email)) {
|
||||||
|
contacts.push(userInfo.email);
|
||||||
|
}
|
||||||
|
_self.model.set({
|
||||||
|
contacts: contacts
|
||||||
|
}, { silent: true });
|
||||||
|
|
||||||
var view = new DynRegEditView({model: _self.model, systemScopeList: _self.options.systemScopeList});
|
var view = new DynRegEditView({model: _self.model, systemScopeList: _self.options.systemScopeList});
|
||||||
|
|
||||||
view.load(function() {
|
view.load(function() {
|
||||||
|
@ -413,7 +432,7 @@ var DynRegEditView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
render:function() {
|
render:function() {
|
||||||
$(this.el).html(this.template({client: this.model.toJSON()}));
|
$(this.el).html(this.template({client: this.model.toJSON(), userInfo: getUserInfo()}));
|
||||||
|
|
||||||
var _self = this;
|
var _self = this;
|
||||||
|
|
||||||
|
@ -444,7 +463,7 @@ var DynRegEditView = Backbone.View.extend({
|
||||||
_self.contactsCollection.add(new Backbone.Model({item:contact}));
|
_self.contactsCollection.add(new Backbone.Model({item:contact}));
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#contacts .controls", this.el).html(new ListWidgetView({
|
$("#contacts .controls div", this.el).html(new ListWidgetView({
|
||||||
placeholder: 'new contact',
|
placeholder: 'new contact',
|
||||||
collection: this.contactsCollection}).render().el);
|
collection: this.contactsCollection}).render().el);
|
||||||
|
|
||||||
|
|
|
@ -332,7 +332,7 @@ var ResRegEditView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
render:function() {
|
render:function() {
|
||||||
$(this.el).html(this.template({client: this.model.toJSON()}));
|
$(this.el).html(this.template({client: this.model.toJSON(), userInfo: getUserInfo()}));
|
||||||
|
|
||||||
var _self = this;
|
var _self = this;
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ var ResRegEditView = Backbone.View.extend({
|
||||||
_self.contactsCollection.add(new Backbone.Model({item:contact}));
|
_self.contactsCollection.add(new Backbone.Model({item:contact}));
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#contacts .controls", this.el).html(new ListWidgetView({
|
$("#contacts .controls div", this.el).html(new ListWidgetView({
|
||||||
placeholder: 'new contact',
|
placeholder: 'new contact',
|
||||||
collection: this.contactsCollection}).render().el);
|
collection: this.contactsCollection}).render().el);
|
||||||
|
|
||||||
|
|
|
@ -225,6 +225,8 @@
|
||||||
<div class="control-group" id="contacts">
|
<div class="control-group" id="contacts">
|
||||||
<label class="control-label">Contacts</label>
|
<label class="control-label">Contacts</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
<p class="help-block">List of contacts for adminstrators of this client. Your email address (<%= userInfo.email %>) will be automatically added to this list on save.</p>
|
||||||
|
<div></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -217,6 +217,8 @@
|
||||||
<div class="control-group" id="contacts">
|
<div class="control-group" id="contacts">
|
||||||
<label class="control-label">Contacts</label>
|
<label class="control-label">Contacts</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
<span class="help-block">List of contacts for adminstrators of this client. Your email address (<%= userInfo.email %>) will be automatically added to this list on save.</span>
|
||||||
|
<div></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue