使用AngularJS的登录机制

时间:2016-02-09 06:59:46

标签: angularjs

您好我的应用程序登录工作正常但有一个问题是例如我的密码是 - 秘密如果我输入 SECRET 有资本或 SEcret 它也登录,如果我给错了密码,它将返回false任何解决方案

登录控制器

app.controller('LoginController',function(loginService, $rootScope,$scope, $http,$location) {

     $scope.login = function () {
        $scope.log=loginService.getLogin( $scope.emailId , $scope.password).
         then(function (response) {
            console.log($scope.log);
            console.log(response)
                     if (response.data.LoginVerificationResult.length === 0) {
                        alert('details are not Available for this emailId');
                        $scope.error=true;

                     } else {
                         $rootScope.name=response.data.LoginVerificationResult[0].UserName;
                         $scope.abc=response.data.LoginVerificationResult[0].UserType
                 console.log($scope.abc+"from.......");
                         sessionStorage.setItem("EmaiId",$scope.emailId);
                         sessionStorage.setItem("User Id",response.data.LoginVerificationResult[0].UserID);
                         sessionStorage.setItem("UserName",response.data.LoginVerificationResult[0].UserName);
                         sessionStorage.setItem("UserType",response.data.LoginVerificationResult[0].UserType);

                            $scope.UserType = sessionStorage.getItem("UserType");
                            console.log($scope.UserType +"from login controller")

                            if ($scope.UserType =='Hr') {
                                 $location.path('/empRegister')
                            }
                            else if ($scope.UserType =='Admin') {
                                $location.path('/patientRegister')
                            }
                            else {
                                 $location.path('/dashboard')
                            }


                     }

         });
     };
});

所有方案都运行正常但问题是上面提到的密码

1 个答案:

答案 0 :(得分:1)

密码匹配正在发生服务器端

目前设置为以case-insensitive方式匹配您的密码。您应该将其更改为匹配case-sensitive密码