Add error checking, add method handler for login
This commit is contained in:
parent
37e02d62c4
commit
784b25754c
5 changed files with 53 additions and 31 deletions
|
@ -1,8 +1,3 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a book.
|
||||
|
@ -10,30 +5,37 @@
|
|||
*/
|
||||
mainApp.controller('loginCtrl', function ($scope,$interval,$sce)
|
||||
{
|
||||
// Define default states
|
||||
$('#loginModal').modal({backdrop: 'static', keyboard: false});
|
||||
$('#loadingLoginButton').hide();
|
||||
$('#failedToLoginAlert').hide();
|
||||
// Define default states
|
||||
$('#loginModal').modal({backdrop: 'static', keyboard: false});
|
||||
$('#loadingLoginButton').hide();
|
||||
$('#failedToLoginAlert').hide();
|
||||
|
||||
|
||||
$('#loginButton').click(function(){
|
||||
$('#loginButton').hide();
|
||||
$('#loadingLoginButton').show();
|
||||
$('#failedToLoginAlert').hide();
|
||||
$('#loginButton').click(function(){
|
||||
$('#loginButton').hide();
|
||||
$('#loadingLoginButton').show();
|
||||
$('#failedToLoginAlert').hide();
|
||||
|
||||
|
||||
var result=identity.login($("#loginFormUsername").val(), $("#loginFormProjectname").val(), $("#loginFormPassword").val());
|
||||
|
||||
$interval(
|
||||
function()
|
||||
{
|
||||
$('#failedToLoginAlert').show();
|
||||
|
||||
$interval(
|
||||
function()
|
||||
{
|
||||
// Check for error
|
||||
if(!errors.checkForLogin(result)){
|
||||
$('#failedToLoginAlert').show();
|
||||
}
|
||||
else {
|
||||
$('#loginModal').modal('hide');
|
||||
}
|
||||
|
||||
// Reset button state
|
||||
$('#loginButton').show();
|
||||
$('#loadingLoginButton').hide();
|
||||
|
||||
}, 2000,1);
|
||||
|
||||
$('#loadingLoginButton').hide();
|
||||
}, 2000,1);
|
||||
|
||||
|
||||
|
||||
});
|
||||
})
|
||||
});
|
||||
|
|
14
client/js/requests/errors.js
Normal file
14
client/js/requests/errors.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
|
||||
var errors={};
|
||||
|
||||
|
||||
errors.checkForLogin=function(result){
|
||||
// TODO
|
||||
return true;
|
||||
};
|
|
@ -1,9 +1,14 @@
|
|||
|
||||
// Make Namespace
|
||||
var identity = {} ;
|
||||
|
||||
var identity = {};
|
||||
|
||||
|
||||
identity.login=function(username, projectname, password){
|
||||
|
||||
// Todo
|
||||
|
||||
return "tokens";
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue