Commit 933c9aea46b6796e5eef3d6557ddae27ce58be72

Authored by Mukul Rajput
1 parent e8a6eac0

this is code for block user

400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -42,6 +42,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
42 42 $rootScope.current_year = AIAConstants.current_year;
43 43 // on refersh this variable will also get null that is why we are only checking this variable on initialize that if it is null that means page gets refershed.
44 44 $rootScope.refreshcheck = null;
  45 +
  46 + $rootScope.isLoginAvilableModel = true;
45 47 $rootScope.isCloseSettingClicked = false;
46 48  
47 49  
... ... @@ -158,6 +160,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
158 160  
159 161 $rootScope.AuthenticateUser = function (userInfo)
160 162 {
  163 +
  164 + alert("sdfsdf" + $rootScope.isLoginAvilableModel);
161 165 if (navigator.cookieEnabled) {
162 166  
163 167 $rootScope.errorMessage = "";
... ... @@ -173,6 +177,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
173 177 .then(
174 178  
175 179 function (result) {
  180 +
  181 +
176 182 if (result == LoginConstants.USER_NOT_FOUND) {
177 183 $rootScope.isVisibleLogin = true;
178 184 // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT);
... ... @@ -240,7 +246,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
240 246 $("#messageModal").modal('show');
241 247 }
242 248 else {
243   -
  249 + debugger;
244 250 //if (result.UserType == UserTypeConstants.SUPER_ADMIN && result.IsActive) { //(!result.IsSubscriptionExpired) &&
245 251 if (result.LicenseId == 0 && result.IsActive) {
246 252 $rootScope.userData = result;
... ... @@ -248,7 +254,14 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
248 254 $rootScope.isVisibleLogin = false;
249 255 $rootScope.haveRoleAdmin = true;
250 256 localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
251   - ShowAssignedModulesPopup(result.Modules);
  257 + alert("first" + $rootScope.isLoginAvilableModel);
  258 + if (($rootScope.isLoginAvilableModel == true) && ($rootScope.refreshcheck == null))
  259 + {
  260 +
  261 + ShowAssignedModulesPopup(result.Modules);
  262 + localStorage.setItem('isLoginAvilableModel',false);
  263 + }
  264 +
252 265 $location.path('/');
253 266  
254 267 }
... ... @@ -259,7 +272,10 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
259 272 $rootScope.isVisibleLogin = false;
260 273 $rootScope.haveRoleAdmin = false;
261 274 localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
262   - ShowAssignedModulesPopup(result.Modules);
  275 + if (($rootScope.isLoginAvilableModel) && ($rootScope.refreshcheck == null)) {
  276 + ShowAssignedModulesPopup(result.Modules);
  277 + localStorage.setItem('isLoginAvilableModel', false);
  278 + }
263 279 $location.path('/');
264 280  
265 281 }
... ... @@ -393,6 +409,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
393 409  
394 410 function getUserDetails() { //Retain logged in user details
395 411 var currentUserDetails = $rootScope.getLocalStorageValue('loggedInUserDetails');
  412 + $rootScope.isLoginAvilableModel = $rootScope.getLocalStorageValue('isLoginAvilableModel');
396 413 if (currentUserDetails) {
397 414 try {
398 415 var userInfo = JSON.parse(currentUserDetails);
... ... @@ -404,12 +421,19 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
404 421 $rootScope.userData = userInfo;
405 422  
406 423 $rootScope.userModules = userInfo.Modules;
407   -
408   - $rootScope.isVisibleLogin = false;
  424 + userInfo["username"] = userInfo.LoginId;
  425 + userInfo["password"] = userInfo.Password;
  426 +
  427 + $rootScope.AuthenticateUser(userInfo);
  428 + // $rootScope.isVisibleLogin = false;
409 429 $rootScope.haveRoleAdmin = true;
410 430  
411 431 if ($rootScope.refreshcheck == null) {
  432 + //setTimeout(function () {
  433 +
  434 + // $('#dvUserModulesInfo').modal('hide')
412 435  
  436 + //}, 400);
413 437 if ($location.path() == "/lab-exercises-detail") {
414 438  
415 439 $location.url('/');
... ...