This commit is contained in:
Anna Bodnia
2016-06-17 11:31:42 +03:00
parent 5cc8af1114
commit dc10f77afd
2 changed files with 21 additions and 10 deletions

21
dist/swagger-ui.js vendored
View File

@@ -19588,7 +19588,7 @@ SwaggerUi.Collections.AuthsCollection = Backbone.Collection.extend({
var authz = Object.assign({}, window.swaggerUi.api.clientAuthorizations.authz);
return _.map(data, function (auth, name) {
var isBasic = authz.basic && auth.type === 'basic';
var isBasic = authz[name] && auth.type === 'basic' && authz[name].username && authz[name].password;
_.extend(auth, {
title: name
@@ -19598,8 +19598,8 @@ SwaggerUi.Collections.AuthsCollection = Backbone.Collection.extend({
_.extend(auth, {
isLogout: true,
value: isBasic ? undefined : authz[name].value,
username: isBasic ? authz.basic.username : undefined,
password: isBasic ? authz.basic.password : undefined,
username: isBasic ? authz[name].username : undefined,
password: isBasic ? authz[name].password : undefined,
valid: true
});
}
@@ -20147,15 +20147,26 @@ 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);
return valid;
}
});
'use strict';
SwaggerUi.Views.Oauth2View = Backbone.View.extend({

File diff suppressed because one or more lines are too long