Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* var response;
- if($scope.username == 'admin' && $scope.password =='admin'){
- response = {success: true};
- } else {
- response = {success: false, message: 'Username or password is incorrect'};
- }*/
- // callback(response);
- // Service Calls Function : userLogin
- // Parameters : $scope.username,$scope.password
- AuthenticationServiceLogin.userLogin($scope.username,$scope.password, function (response) {
- console.log(response.success);
- if(response.success)
- {
- AuthenticationServiceLogin.SetCredentials(response);
- toaster.pop('success', "", "Login Successful");
- $location.path('/home');
- }
- if (response.status ==200) {
- var stompCtrl = $rootScope.$new();
- $controller('StompController', { $scope: stompCtrl });
- toaster.pop('success', "", "Login Successful");
- $location.path('/home');
- }
- else if(response.status ==401){
- toaster.pop('error', response.status+" "+response.statusText," Access is denied due to invalid credentials");
- $scope.dataLoading = false;
- }
- else {
- toaster.pop('error', "Username / Password", "Username or password is incorrect");
- $scope.dataLoading = false;
- }
- });
- };
- });
- if(username == 'admin' && password =='admin'){
- response = {success: true};
- }
- callback(response);
- }, 900);
- }
- };
- spyOn(AuthenticationServiceLogin,'userLogin').and.returnValue(response);
- spyOn(AuthenticationServiceLogin,'forgetPassword').and.returnValue(response);
- }));
- var $scope = {};
- var $rootscope = {};
- var $location = {};
- var $cookieStore = {};
- var $http = {};
- var $controller = {};
- var FlashService = {};
- var controller = $controller1('loginCtrl',{
- $scope: $scope,
- $rootscope: $rootscope,
- $location: $location,
- $window: $window,
- $cookieStore:$cookieStore,
- AuthenticationServiceLogin:AuthenticationServiceLogin,
- FlashService:FlashService,
- $http:$http,
- $controller:$controller
- });
- $scope.username="admin";
- $scope.password="admin";
- $scope.login();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement