text: ﻿(function () {
      'use strict';
      angular.module('app').controller('LoginController', LoginController);
      LoginController.$inject = ['$location', 'AuthenticationService', 'FlashService'];
  
      function LoginController($location, AuthenticationService, FlashService) {
          let vm = this;
          vm.login = login;
  
          (function initController() {
              AuthenticationService.ClearCredentials();
          })();
  
          function login() {
              vm.dataLoading = true;
              AuthenticationService.Login(vm.username, vm.password, function (response) {
                  if (response.success) {
                      AuthenticationService.SetCredentials(vm.username, vm.password, response.user);
                      $location.path('/');
                  } else {
                      FlashService.Error(response.message);
                      vm.dataLoading = false;
                  }
              });
          }
      }
  })();
  