Update Oauth2Model.js

This commit is contained in:
Christian
2016-05-25 13:52:31 +02:00
parent 56a62d9f84
commit 596f57596f

View File

@@ -21,9 +21,19 @@ SwaggerUi.Models.Oauth2Model = Backbone.Model.extend({
},
validate: function () {
var valid = _.findIndex(this.get('scopes'), function (o) {
var valid = false;
var scp = this.get('scopes');
var idx = _.findIndex(scp, function (o) {
return o.checked === true;
}) > -1;
});
if(scp.length > 0 && idx >= 0) {
valid = true;
}
if(scp.length == 0) {
valid = true;
}
this.set('valid', valid);