Sha256: 89c5588341e16efcc8665f158c65bb8a93a3da948036763606b5c543f5168311

Contents?: true

Size: 1.64 KB

Versions: 36

Compression:

Stored size: 1.64 KB

Contents

App.Views.Index = Backbone.View.extend({
	
	events: {
		"submit form" : "login"
	},
	
    initialize: function() {
        this.render();
    },

	login: function(e) {
		e.preventDefault();
		var login = $('#loginindex').val();
		var password = $("#password").val();
		$.ajax({
			type: 'POST',
			url: '/rc/v1/system/login',
			data: {login:login,password:password},
			success: function(resp){
				var session = new Session();
				session.setAuthenticated(true);
				session.setApiKey(resp);
				$('#login').css('display','inline');
				router.navigate('#home',true)
			},
			error: function(resp){
				if(resp.status == 422){
					new App.Views.Index()
				}
		        $('#home-alert').css('display','block');
				$('#home-alert')[0].innerHTML = resp.responseText;
			}
		})
	},

    render: function () {
   	    $('#secondary-nav').css('display','none');
		out  = "<div class='page-header well' style='margin-top:60px'><h1>Login</h1></div>";
		out += "<div id='home-alert' class='alert alert-error' style='display:none'></div>";
		out += "<form id='index-form'>";
	    out += "<table class='table table-bordered'>";
	    out += "<tr><td><input id='loginindex' type='text' name='login' class='input-xlarge' value='rhoadmin' placeholder='rhoadmin'/></td></tr>";
	    out += "<tr><td><input id='password' type='password' name='password' class='input-xlarge' value='' placeholder='Enter Password'/></td></tr>";
	    out += "<tr><td colspan=2><input type='submit' class='btn btn-primary' value='Login'/></td></tr>";
		out += "</table></form>";

        $(this.el).html(out);
        $('#main_content').html(this.el);  
    }
});
	
			
			
				
	
		
			
			
				
			
	
		
			

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
rhoconnect-7.6.0 lib/rhoconnect/web-console/views/index.js
rhoconnect-7.5.1 lib/rhoconnect/web-console/views/index.js
rhoconnect-7.4.1 lib/rhoconnect/web-console/views/index.js
rhoconnect-7.1.17 lib/rhoconnect/web-console/views/index.js
rhoconnect-6.2.0 lib/rhoconnect/web-console/views/index.js
rhoconnect-6.0.11 lib/rhoconnect/web-console/views/index.js
rhoconnect-5.5.18 lib/rhoconnect/web-console/views/index.js
rhoconnect-5.5.17 lib/rhoconnect/web-console/views/index.js
rhoconnect-5.5.15 lib/rhoconnect/web-console/views/index.js
rhoconnect-5.5.0.22 lib/rhoconnect/web-console/views/index.js
rhoconnect-5.5.2 lib/rhoconnect/web-console/views/index.js
rhoconnect-5.5.0.7 lib/rhoconnect/web-console/views/index.js
rhoconnect-5.5.0.3 lib/rhoconnect/web-console/views/index.js
rhoconnect-5.5.0 lib/rhoconnect/web-console/views/index.js
rhoconnect-5.1.1 lib/rhoconnect/web-console/views/index.js
rhoconnect-4.0.4 lib/rhoconnect/web-console/views/index.js
rhoconnect-4.0.3 lib/rhoconnect/web-console/views/index.js
rhoconnect-4.0.2 lib/rhoconnect/web-console/views/index.js
rhoconnect-4.0.1 lib/rhoconnect/web-console/views/index.js
rhoconnect-4.0.0 lib/rhoconnect/web-console/views/index.js