AC-198 Failed login attempts now dispaly with the alert-error class (red) rather than whatever class producess a yellow color.

This commit is contained in:
chouseknecht 2013-07-12 11:01:49 -04:00
parent 613fafff05
commit 3f2f0ebc59
3 changed files with 10 additions and 10 deletions

View File

@ -4,7 +4,7 @@
*
* awx-min.js
*
* master-b32c0dc, Thu Jul 11 23:36:14 2013 -0400
* master-c9b19ba, Fri Jul 12 10:30:38 2013 -0400
*
*/
var urlPrefix="/static/";
@ -25,7 +25,7 @@ c.replace(/\_/g," ");$('.nav-tabs a[href="#'+c+'"]').tab("show");k.viewCurrentUs
data:a,status:b});u.$emit("callFinished")}).error(function(a,b,d,c){u.queue.push({result:"error",data:a,status:b,headers:d});u.$emit("callFinished")})}else v(1)};u.toggle_admin=function(a){"success"==u[e.iterator+"_"+a+"_class"]?(u[e.iterator+"_"+a+"_class"]="",document.getElementById("check_"+a).checked=!1,-1<u.selected.indexOf(a)&&u.selected.splice(u.selected.indexOf(a),1)):(u[e.iterator+"_"+a+"_class"]="success",document.getElementById("check_"+a).checked=!0,-1==u.selected.indexOf(a)&&u.selected.push(a))}}
AdminsList.$inject="$scope $rootScope $location $log $routeParams Rest Alert AdminList GenerateList LoadBreadCrumbs Prompt SearchInit PaginateInit ReturnToCaller GetBasePath".split(" ");function Authenticate(k,m,g,h,c,p){"/logout"==g.path()&&h.logout();m.userLoggedIn=!1;k.sessionExpired=h.didSessionExpire();k.sessionTimeout=($AnsibleConfig.session_timeout/60).toFixed(2);$("#login-password").bind("keypress",function(c){13==(c.keyCode?c.keyCode:c.which)&&$("#login-button").click()});$("#login-modal").modal({show:!0,keyboard:!1,backdrop:!1});k.reset=function(){$("#login-form input").each(function(c){$(this).val("")})};k.systemLogin=function(c,e){$(".api-error").empty();h.retrieveToken(c,
e).success(function(c,a,d,b){h.setToken(c.token);k.reset();h.getUser().success(function(a,b,d,c){$("#login-modal").modal("hide");h.setUserInfo(a);h.getLicense().success(function(a,b,d,c){h.setLicense(a.license_info);g.path("/organizations")}).error(function(a,b,d,c){p("Error","Failed to access user information. GET returned status: "+b)})}).error(function(a,b,d,c){p("Error","Failed to access license information. GET returned status: "+b)})}).error(function(c,a,d,b){if(c.non_field_errors&&0==c.non_field_errors.length)for(var f in c)k[f+
"Error"]=c[f][0];else c.non_field_errors&&0<c.non_field_errors.length?(m.alertHeader="Error!",m.alertBody=c.non_field_errors[0]):(m.alertHeader="Error!",m.alertBody="The login attempt failed with a status of: "+a),k.reset(),$("#alert-modal").modal({show:!0,keyboard:!0,backdrop:"static"})})}}Authenticate.$inject="$scope $rootScope $location Authorization ToggleClass Alert".split(" ");function CredentialsList(k,m,g,h,c,p,f,e,l,a,d,b,z,v,B,u,x){B("htmlTemplate");var t=x("credentials"),s=g.path().replace(/^\//,"").split("/")[0],n=l.inject(e,{mode:"credentials"==s?"edit":"select"});n.selected=[];n.PostRefreshRemove&&n.PostRefreshRemove();n.PostRefreshRemove=n.$on("PostRefresh",function(){$("tr.success").each(function(a){a=$(this).attr("ng-class");n[a]=""})});b({scope:n,set:"credentials",list:e,url:t});z({scope:n,list:e,url:t});n.search(e.iterator);a();n.addCredential=function(){g.path(g.path()+
"Error"]=c[f][0];else c.non_field_errors&&0<c.non_field_errors.length?(d="Error",c=c.non_field_errors[0]):(d="Error",c="The login attempt failed with a status of: "+a),k.reset(),p(d,c)})}}Authenticate.$inject="$scope $rootScope $location Authorization ToggleClass Alert".split(" ");function CredentialsList(k,m,g,h,c,p,f,e,l,a,d,b,z,v,B,u,x){B("htmlTemplate");var t=x("credentials"),s=g.path().replace(/^\//,"").split("/")[0],n=l.inject(e,{mode:"credentials"==s?"edit":"select"});n.selected=[];n.PostRefreshRemove&&n.PostRefreshRemove();n.PostRefreshRemove=n.$on("PostRefresh",function(){$("tr.success").each(function(a){a=$(this).attr("ng-class");n[a]=""})});b({scope:n,set:"credentials",list:e,url:t});z({scope:n,list:e,url:t});n.search(e.iterator);a();n.addCredential=function(){g.path(g.path()+
"/add")};n.editCredential=function(a){g.path(g.path()+"/"+a)};n.deleteCredential=function(a,b){d({hdr:"Delete",body:"Are you sure you want to delete "+b+"?",action:function(){var b=t+a+"/";p.setUrl(b);p.destroy().success(function(a,b,d,c){$("#prompt-modal").modal("hide");n.search(e.iterator)}).error(function(a,d,c,f){$("#prompt-modal").modal("hide");u(n,a,d,null,{hdr:"Error!",msg:"Call to "+b+" failed. DELETE returned status: "+d})})}})};n.finishSelection=function(){var a=x(s),a=a+("users"==s?c.user_id+
"/credentials/":c.team_id+"/credentials/");p.setUrl(a);n.queue=[];n.$on("callFinished",function(){if(n.queue.length==n.selected.length){$('input[type="checkbox"]').prop("checked",!1);n.selected=[];for(var a=0,b=0;b<n.queue.length;b++)"error"==n.queue[b].result&&a++;0<a?f("Error","There was an error while adding one or more of the selected Credentials."):v(1)}});if(0<n.selected.length)for(var a=null,b=0;b<n.selected.length;b++){for(var d=0;d<n.credentials.length;d++)n.credentials[d].id==n.selected[b]&&
(a=n.credentials[d]);null!==a&&p.post(a).success(function(a,b,d,c){n.queue.push({result:"success",data:a,status:b});n.$emit("callFinished")}).error(function(a,b,d,c){n.queue.push({result:"error",data:a,status:b,headers:d});n.$emit("callFinished")})}else v()};n.toggle_credential=function(a){"success"==n[e.iterator+"_"+a+"_class"]?(n[e.iterator+"_"+a+"_class"]="",document.getElementById("check_"+a).checked=!1,-1<n.selected.indexOf(a)&&n.selected.splice(n.selected.indexOf(a),1)):(n[e.iterator+"_"+a+

View File

@ -77,16 +77,17 @@ function Authenticate($scope, $rootScope, $location, Authorization, ToggleClass,
}
}
else {
if ( data.non_field_errors && data.non_field_errors.length > 0 ) {
$rootScope.alertHeader = 'Error!';
$rootScope.alertBody = data.non_field_errors[0];
var hdr, msg;
if ( data.non_field_errors && data.non_field_errors.length > 0 ) {
hdr = 'Error';
msg = data.non_field_errors[0];
}
else {
$rootScope.alertHeader = 'Error!';
$rootScope.alertBody = 'The login attempt failed with a status of: ' + status;
hdr = 'Error';
msg = 'The login attempt failed with a status of: ' + status;
}
$scope.reset();
$('#alert-modal').modal({ show: true, keyboard: true, backdrop: 'static' });
Alert(hdr, msg);
}
});
}

View File

@ -27,8 +27,7 @@
</form>
</div>
<div class="modal-footer">
<button ng-click="systemLogin(login_username, login_password)"
id="login-button" class="btn btn-primary">Sign In</button>
<button ng-click="systemLogin(login_username, login_password)" id="login-button" class="btn btn-primary">Sign In</button>
</div>
</div><!-- modal -->