forked from braitsch/node-login
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding session support and a million other things
- Loading branch information
Stephen Braitsch
committed
May 30, 2012
1 parent
5f6404e
commit 2de000e
Showing
13 changed files
with
190 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
$(document).ready(function(){ | ||
|
||
$('#btn-logout').click(function(){ | ||
console.log('logout clicked') | ||
var req = $.ajax({ | ||
url: "/home", | ||
type: "POST", | ||
data: {logout : true} | ||
}); | ||
|
||
req.done(function(msg) { | ||
window.location.href = '/'; | ||
}); | ||
|
||
req.fail(function(jqXHR, textStatus) { | ||
console.log( "request failed: " + textStatus ); | ||
}); | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
$(document).ready(function(){ | ||
|
||
// the login form that shows when the page loads // | ||
|
||
$('#loginForm').ajaxForm({ | ||
beforeSubmit : function(formData, jqForm, options){ | ||
if ($('#user').val() == ''){ | ||
showLoginError('Whoops!', 'Please enter a valid username'); | ||
return false; | ||
} else if ($('#pass').val() == ''){ | ||
showLoginError('Whoops!', 'Please enter a valid password'); | ||
return false; | ||
} else{ | ||
console.log('about to submit :: '+$.param(formData)); | ||
return pass; | ||
} | ||
}, | ||
success : function(responseText, status, xhr, $form){ | ||
if (status == 'success') window.location.href = '/home'; | ||
}, | ||
error : function(e){ | ||
showLoginError('Login Failure', 'Please check your username and/or password'); | ||
} | ||
}); | ||
$('#loginForm #forgot-pass').click(function(){ $('#sendCredentials').modal('show');}); | ||
|
||
// modal window to display any login form errors // | ||
|
||
$('#loginFailure').modal({ | ||
show : false, | ||
keyboard : true, | ||
backdrop : true | ||
}); | ||
|
||
function showLoginError(t, m) | ||
{ | ||
$('#loginFailure .modal-header h3').text(t); | ||
$('#loginFailure .modal-body p').text(m); | ||
$('#loginFailure').modal('show'); | ||
} | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
- user= udata[0] | ||
|
||
div.navbar.navbar-fixed-top | ||
div.navbar-inner | ||
div.container-fluid | ||
ul#global-nav.nav.pull-left | ||
li.divider-vertical | ||
a(href='#').brand Hello ! | ||
li.divider-vertical | ||
a(href='#').brand Control Panel | ||
button#btn-logout.btn.btn-primary | ||
i.icon-lock.icon-white | ||
| Sign Out | ||
|
||
|
||
#userData | ||
p= 'Welcome :: '+ user.name +' , '+user.email+' , '+ user.country +' , '+ user.user +' , '+user.pass | ||
|
||
script(src='/vendor/jquery.min.js') | ||
script(src='/js/home.js') |
Oops, something went wrong.