Update routes, mongoose schema and web flow

This commit is contained in:
Reynaldo Reyes
2016-03-27 23:24:28 -04:30
parent b8b65e64d7
commit 7fff896e43
34 changed files with 735 additions and 631 deletions

View File

@@ -0,0 +1,49 @@
(function(){
'use strict';
angular
.module('app.login')
.factory('Login', Login)
.factory('GetRol', GetRol)
.factory('hash', hash)
.value('algoritmo','SHA-1')
.value('user',{})
.value('id',{})
Login.$inject = ['$resource','$rootScope'];
function Login($resource, $rootScope){
return $resource('http://'+$rootScope.domainUrl+'/api/VerifyUser');
};
GetRol.$inject = ['$resource','$rootScope'];
function GetRol($resource, $rootScope){
return $resource('http://'+$rootScope.domainUrl+'/api/User/:id');
};
hash.$inject = ['algoritmo'];
function hash(algoritmo){
var hashFunction;
if (algoritmo==="MD5") {
hashFunction=CryptoJS.MD5;
} else if (algoritmo==="SHA-1") {
hashFunction=CryptoJS.SHA1;
} else if (algoritmo==="SHA-2-256") {
hashFunction=CryptoJS.SHA256;
} else if (algoritmo==="SHA-2-512") {
hashFunction=CryptoJS.SHA512;
} else {
throw Error("El tipo de algoritmo no es válido:"+algoritmo);
}
var hash=function(message) {
var objHashResult=hashFunction(message);
var strHashResult=objHashResult.toString(CryptoJS.enc.Base64);
return strHashResult;
}
return hash;
};
})();