diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 8df1a9f..dc5cb13 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -151,6 +151,17 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A if ($scope.currentUserDetails != undefined) { AuthenticateAlreadyLoggedInUser(); } + var isRememberChecked = $rootScope.getLocalStorageValue('isRememberMeChecked'); + + if ($rootScope.getLocalStorageValue('isRememberMeChecked') != "" && sessionStorage.getItem("loginSession") == null) { + sessionStorage.setItem("loginSession", "true"); + } + if (isRememberChecked == "true" && sessionStorage.getItem("loginSession") == "true" && $rootScope.isVisibleLogin == true) { + + $timeout(function () { + $rootScope.userInfo = { username: $rootScope.getLocalStorageValue('RememberMeLoginId'), password: $rootScope.getLocalStorageValue('RememberMePassword'), rememberChk: true }; + }, 800); + } } } @@ -268,9 +279,17 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A if (isCommingSoonModel == true) { - ShowAssignedModulesPopup(result.Modules); - $rootScope.isVisibleLogin = false; - localStorage.setItem('isCommingSoonModel', false); + ShowAssignedModulesPopup(result.Modules); + + if (userInfo.rememberChk) { + + $scope.saveRemeberMeDetails(result, userInfo); + } + + sessionStorage.setItem("loginSession", "true"); + localStorage.setItem('isCommingSoonModel', false); + + $rootScope.isVisibleLogin = false; } @@ -280,25 +299,41 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A else { if (result.LicenseInfo != null && result.LicenseInfo.IsTermAccepted) { + //0. $rootScope.userData = result; $rootScope.userModules = result.Modules; - //set haveRoleAdmin = false because LicenseInfo is not null + //1. set haveRoleAdmin = false because LicenseInfo is not null $rootScope.haveRoleAdmin = false; + //2. if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") { localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); } - if (isCommingSoonModel == true) { + // 3.ShowAssignedModulesPopup + //isCommingSoonModel =true only when user comes first time on application and login + if (isCommingSoonModel == true) + { ShowAssignedModulesPopup(result.Modules); - $rootScope.isVisibleLogin = false; - localStorage.setItem('isCommingSoonModel', false); } - + //4. + if($scope.rememberChk) + { + + $scope.saveRemeberMeDetails(result, userInfo); + } + + //5. + sessionStorage.setItem("loginSession", "true"); + $rootScope.isVisibleLogin = false; + + //6. reset the isCommingSoonModel to false in local storage so that upcomming module pop up would not show again to the user after firts time + localStorage.setItem('isCommingSoonModel', false); + $location.path('/'); } @@ -314,6 +349,8 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A $location.path('/'); } } + + } @@ -336,7 +373,15 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A $rootScope.promptUserForCookies(); } - } + } + + $scope.saveRemeberMeDetails = function (result, userInfo) { + + localStorage.setItem('RememberMeLoginId', result.LoginId); + localStorage.setItem('RememberMePassword', result.Password); + localStorage.setItem("isRememberMeChecked", userInfo.rememberChk); + } + function ShowAssignedModulesPopup(userModules) { var allModules = Modules; @@ -374,6 +419,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A $('#dvPendingModules').show(); } } + $rootScope.UpdateLicenseTermStatus = function () { $('#dvTermCondition').fadeOut(); var currentUserDetails = $rootScope.getLocalStorageValue('loggedInUserDetails'); @@ -421,20 +467,32 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A }); } }; + $rootScope.RememberMe = function (isRememberMeChecked) + { + if (localStorage.getItem('isRememberMeChecked') != null) + { + localStorage.removeItem('loggedInUserDetails'); + localStorage.removeItem('isRememberMeChecked'); + localStorage.removeItem('RememberMeLoginId'); + localStorage.removeItem('RememberMePassword'); + + } + + } $rootScope.LogoutUser = function () { localStorage.removeItem('loggedInUserDetails'); - localStorage.clear(); + // localStorage.clear(); document.location = '/'; $rootScope.isVisibleLogin = true; } function AuthenticateAlreadyLoggedInUser() { - + isCommingSoonModel = $rootScope.getLocalStorageValue('isCommingSoonModel'); - + try { var userInfo = JSON.parse($scope.currentUserDetails); @@ -499,6 +557,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A } } } + } catch (e) { localStorage.removeItem('loggedInUserDetails'); diff --git a/400-SOURCECODE/AIAHTML5.Web/index.html b/400-SOURCECODE/AIAHTML5.Web/index.html index 8d79c6e..48a1779 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.html +++ b/400-SOURCECODE/AIAHTML5.Web/index.html @@ -205,9 +205,12 @@ Forgot Password?-->
- +
Forgot Password? +
+ +
diff --git a/400-SOURCECODE/AIAHTML5.Web/themes/default/css/bootstrap/3.3.6/main.css b/400-SOURCECODE/AIAHTML5.Web/themes/default/css/bootstrap/3.3.6/main.css index dbd027f..5cc9399 100644 --- a/400-SOURCECODE/AIAHTML5.Web/themes/default/css/bootstrap/3.3.6/main.css +++ b/400-SOURCECODE/AIAHTML5.Web/themes/default/css/bootstrap/3.3.6/main.css @@ -1263,4 +1263,9 @@ a[disabled] { #LabExMinimizedId .fa { font-size: 15px; -} \ No newline at end of file +} + +#UserPassword + { + -webkit-text-security: disc; + } \ No newline at end of file