123456789101112131415161718192021222324252627282930313233 |
- angular.module('luticate')
- .controller('LoginController', ['$scope', '$state', 'luticateAuthUsers', 'luticateAuthCache',
- function($scope, $state, luticateAuthUsers, luticateAuthCache) {
- $scope.username = "";
- $scope.password = "";
- $scope.errorString = null;
-
- var promiseLogin = {
- id: "promiseLogin",
- loaderGroups: ["loginForm"]
- };
-
- if (luticateAuthCache.getUser() != null) {
- $state.go('home');
- return;
- }
-
- $scope.login = function()
- {
- $scope.errorString = null;
- if ($scope.username != "") {
- luticateAuthUsers.login({username: $scope.username, password: $scope.password}, promiseLogin)
- .then(function(user)
- {
- $state.go('home');
- }, function(error)
- {
- $scope.errorString = error.Data;
- });
- }
- };
- }
- ]);
|