API Docs for:
Show:

LoginController Class

АУТЕНТИФИКАЦИЯ ПОЛЬЗОВАТЕЛЯ

   LoginController.$inject = ['$location', 'AuthenticationService', 'FlashService'];

   function LoginController($location, AuthenticationService, FlashService) {

       var vm = this;

       vm.login = login;

       (function initController() {
           // reset login status
           AuthenticationService.ClearCredentials();
       })();

       function login() {
           vm.dataLoading = true;
           AuthenticationService.Login(vm.username, vm.password, function (response) {
               if (response.success) {
                   AuthenticationService.SetCredentials(vm.username, vm.password);
                   $location.path('/');
               } else {
                   FlashService.Error(response.message);
                   vm.dataLoading = false;
               }
           });
       };
   }

Item Index

Methods

initController

()

initController
СБРОСИТЬ login СТАТУС - AuthenticationService.ClearCredentials()

login

()

login
ПРОВЕРКА username И password
ЕСЛИ ВСЕ ОК - $location.path('/')