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});
|
||||
view.load(function() {
|
||||
// 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({
|
||||
tokenEndpointAuthMethod: "SECRET_BASIC",
|
||||
generateClientSecret:true,
|
||||
|
@ -541,7 +547,8 @@ var AppRouter = Backbone.Router.extend({
|
|||
idTokenValiditySeconds:600,
|
||||
grantTypes: ["authorization_code"],
|
||||
responseTypes: ["code"],
|
||||
subjectType: "PUBLIC"
|
||||
subjectType: "PUBLIC",
|
||||
contacts: contacts
|
||||
}, { silent: true });
|
||||
|
||||
|
||||
|
@ -903,6 +910,12 @@ var AppRouter = Backbone.Router.extend({
|
|||
|
||||
view.load(function() {
|
||||
|
||||
var userInfo = getUserInfo();
|
||||
var contacts = [];
|
||||
if (userInfo != null && userInfo.email != null) {
|
||||
contacts.push(userInfo.email);
|
||||
}
|
||||
|
||||
client.set({
|
||||
require_auth_time:true,
|
||||
default_max_age:60000,
|
||||
|
@ -910,7 +923,8 @@ var AppRouter = Backbone.Router.extend({
|
|||
token_endpoint_auth_method: 'client_secret_basic',
|
||||
grant_types: ["authorization_code"],
|
||||
response_types: ["code"],
|
||||
subject_type: "public"
|
||||
subject_type: "public",
|
||||
contacts: contacts
|
||||
}, { silent: true });
|
||||
|
||||
$('#content').html(view.render().el);
|
||||
|
@ -968,9 +982,16 @@ var AppRouter = Backbone.Router.extend({
|
|||
|
||||
view.load(function() {
|
||||
|
||||
var userInfo = getUserInfo();
|
||||
var contacts = [];
|
||||
if (userInfo != null && userInfo.email != null) {
|
||||
contacts.push(userInfo.email);
|
||||
}
|
||||
|
||||
client.set({
|
||||
scope: _.uniq(_.flatten(app.systemScopeList.defaultDynRegScopes().pluck("value"))).join(" "),
|
||||
token_endpoint_auth_method: 'client_secret_basic',
|
||||
contacts: contacts
|
||||
}, { silent: true });
|
||||
|
||||
$('#content').html(view.render().el);
|
||||
|
|
|
@ -128,13 +128,22 @@ var DynRegRootView = Backbone.View.extend({
|
|||
var self = this;
|
||||
|
||||
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});
|
||||
|
||||
view.load(function() {
|
||||
$('#content').html(view.render().el);
|
||||
view.delegateEvents();
|
||||
setPageTitle("Dynamically Register a New Client");
|
||||
setPageTitle("Edit a Dynamically Registered Client");
|
||||
app.navigate('dev/dynreg/edit', {trigger: true});
|
||||
self.remove();
|
||||
});
|
||||
|
@ -383,7 +392,17 @@ var DynRegEditView = Backbone.View.extend({
|
|||
// switch to an "edit" view
|
||||
app.navigate('dev/dynreg/edit', {trigger: true});
|
||||
_self.remove();
|
||||
var view = new DynRegEditView({model: _self.model, systemScopeList: _self.options.systemScopeList});
|
||||
|
||||
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});
|
||||
|
||||
view.load(function() {
|
||||
// reload
|
||||
|
@ -413,7 +432,7 @@ var DynRegEditView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
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;
|
||||
|
||||
|
@ -444,7 +463,7 @@ var DynRegEditView = Backbone.View.extend({
|
|||
_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',
|
||||
collection: this.contactsCollection}).render().el);
|
||||
|
||||
|
|
|
@ -332,7 +332,7 @@ var ResRegEditView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
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;
|
||||
|
||||
|
@ -363,7 +363,7 @@ var ResRegEditView = Backbone.View.extend({
|
|||
_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',
|
||||
collection: this.contactsCollection}).render().el);
|
||||
|
||||
|
|
|
@ -225,6 +225,8 @@
|
|||
<div class="control-group" id="contacts">
|
||||
<label class="control-label">Contacts</label>
|
||||
<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>
|
||||
|
||||
|
|
|
@ -217,6 +217,8 @@
|
|||
<div class="control-group" id="contacts">
|
||||
<label class="control-label">Contacts</label>
|
||||
<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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue