Merged
Merge Request #1021
·
created by
Aia develop
merge user session changes to QA
From
AIA_Develop
into
AIA_QA
Showing
32 changed files
400-SOURCECODE/AIAHTML5.ADMIN.API/Constants/AdminConstant.cs
... | ... | @@ -15,5 +15,6 @@ namespace AIAHTML5.Server.Constants |
15 | 15 | |
16 | 16 | public const string SUCCESS = "Success"; |
17 | 17 | public const string FAILED = "Failed"; |
18 | + public const string SQL_CONNECTION_ERROR = "We are unable to connect with database. Please contact customer support."; | |
18 | 19 | } |
19 | 20 | } |
20 | 21 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs
... | ... | @@ -111,6 +111,28 @@ namespace AIAHTML5.ADMIN.API.Controllers |
111 | 111 | return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); |
112 | 112 | } |
113 | 113 | } |
114 | + | |
115 | + [Route("ManageUserLoginStatus")] | |
116 | + [HttpPost] | |
117 | + public HttpResponseMessage ManageUserLoginStatus(JObject jsonData) | |
118 | + { | |
119 | + bool Status = false; | |
120 | + int userId = jsonData["userId"].Value<Int32>(); | |
121 | + string tagName = jsonData["tagName"].Value<string>(); | |
122 | + bool isAlreadyLoggedIn = jsonData["isAlreadyLoggedIn"].Value<bool>(); | |
123 | + try | |
124 | + { | |
125 | + Status = UserModel.ManageUserLoginStatus(dbContext, userId, tagName, isAlreadyLoggedIn); | |
126 | + | |
127 | + return Request.CreateResponse(HttpStatusCode.OK, Status.ToString()); | |
128 | + } | |
129 | + catch (Exception ex) | |
130 | + { | |
131 | + // Log exception code goes here | |
132 | + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, AdminConstant.SQL_CONNECTION_ERROR); | |
133 | + } | |
134 | + } | |
135 | + | |
114 | 136 | [Route("UpdateUserId")] |
115 | 137 | [HttpPost] |
116 | 138 | public HttpResponseMessage UpdateUserId(UserModel userInfo) |
... | ... | @@ -162,19 +184,20 @@ namespace AIAHTML5.ADMIN.API.Controllers |
162 | 184 | |
163 | 185 | [Route("Users")] |
164 | 186 | [HttpGet] |
165 | - public IHttpActionResult UserList(string firstname, string lastname, string emailid, string accountnumber, string usertypeid, string accounttypeid, | |
187 | + public IHttpActionResult UserList(string firstname, string lastname, string emailid, string accountnumber, string usertypeid, string accounttypeid, string userLoginStatus, | |
166 | 188 | int pageNo, int pageLength, int iLoginUserType,string loggedIn="") |
167 | 189 | { |
168 | 190 | try |
169 | 191 | { |
170 | 192 | int UserTypeId = (!string.IsNullOrEmpty(usertypeid) ? Convert.ToInt32(usertypeid) : 0); |
171 | 193 | int AccountTypeId = (!string.IsNullOrEmpty(accounttypeid) ? Convert.ToInt32(accounttypeid) : 0); |
194 | + bool loginStatus = Convert.ToBoolean(userLoginStatus); | |
172 | 195 | int recordCount = 0; |
173 | 196 | dbContext.Configuration.ProxyCreationEnabled = false; |
174 | 197 | //var spStatus = new System.Data.Objects.ObjectParameter("Status", 0); |
175 | 198 | var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); |
176 | 199 | //recordCount = (int)spRecordCount.Value; |
177 | - List<usp_GetUsersList_Result> Users = dbContext.usp_GetUsersList(firstname, lastname, emailid, accountnumber, UserTypeId, AccountTypeId, iLoginUserType, pageNo, pageLength, spRecordCount).ToList(); | |
200 | + List<usp_GetUsersList_Result> Users = dbContext.usp_GetUsersList(firstname, lastname, emailid, accountnumber, UserTypeId, AccountTypeId, iLoginUserType, loginStatus, pageNo, pageLength, spRecordCount).ToList(); | |
178 | 201 | if (!string.IsNullOrEmpty(loggedIn)) |
179 | 202 | { |
180 | 203 | if (Users.Where(s => s.LoginId == loggedIn).Count() > 0) | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs
... | ... | @@ -4399,7 +4399,7 @@ namespace AIAHTML5.ADMIN.API.Entity |
4399 | 4399 | return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<string>("usp_GetUserList", sFirstNameParameter, sLastNameParameter, sEmailIdParameter, sAccoutNumberParameter, iUserTypeIdParameter, iAccountTypeIdParameter, iLoginUserTypeParameter, pageNoParameter, pageLengthParameter, recordCount); |
4400 | 4400 | } |
4401 | 4401 | |
4402 | - public virtual ObjectResult<usp_GetUsersList_Result> usp_GetUsersList(string sFirstName, string sLastName, string sEmailId, string sAccoutNumber, Nullable<int> iUserTypeId, Nullable<int> iAccountTypeId, Nullable<int> iLoginUserType, Nullable<int> pageNo, Nullable<int> pageLength, ObjectParameter recordCount) | |
4402 | + public virtual ObjectResult<usp_GetUsersList_Result> usp_GetUsersList(string sFirstName, string sLastName, string sEmailId, string sAccoutNumber, Nullable<int> iUserTypeId, Nullable<int> iAccountTypeId, Nullable<int> iLoginUserType, Nullable<bool> iLoginStatus, Nullable<int> pageNo, Nullable<int> pageLength, ObjectParameter recordCount) | |
4403 | 4403 | { |
4404 | 4404 | var sFirstNameParameter = sFirstName != null ? |
4405 | 4405 | new ObjectParameter("sFirstName", sFirstName) : |
... | ... | @@ -4429,6 +4429,10 @@ namespace AIAHTML5.ADMIN.API.Entity |
4429 | 4429 | new ObjectParameter("iLoginUserType", iLoginUserType) : |
4430 | 4430 | new ObjectParameter("iLoginUserType", typeof(int)); |
4431 | 4431 | |
4432 | + var iLoginStatusParameter = iLoginStatus.HasValue ? | |
4433 | + new ObjectParameter("iLoginStatus", iLoginStatus) : | |
4434 | + new ObjectParameter("iLoginStatus", typeof(bool)); | |
4435 | + | |
4432 | 4436 | var pageNoParameter = pageNo.HasValue ? |
4433 | 4437 | new ObjectParameter("pageNo", pageNo) : |
4434 | 4438 | new ObjectParameter("pageNo", typeof(int)); |
... | ... | @@ -4437,7 +4441,7 @@ namespace AIAHTML5.ADMIN.API.Entity |
4437 | 4441 | new ObjectParameter("pageLength", pageLength) : |
4438 | 4442 | new ObjectParameter("pageLength", typeof(int)); |
4439 | 4443 | |
4440 | - return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<usp_GetUsersList_Result>("usp_GetUsersList", sFirstNameParameter, sLastNameParameter, sEmailIdParameter, sAccoutNumberParameter, iUserTypeIdParameter, iAccountTypeIdParameter, iLoginUserTypeParameter, pageNoParameter, pageLengthParameter, recordCount); | |
4444 | + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<usp_GetUsersList_Result>("usp_GetUsersList", sFirstNameParameter, sLastNameParameter, sEmailIdParameter, sAccoutNumberParameter, iUserTypeIdParameter, iAccountTypeIdParameter, iLoginUserTypeParameter, iLoginStatusParameter, pageNoParameter, pageLengthParameter, recordCount); | |
4441 | 4445 | } |
4442 | 4446 | |
4443 | 4447 | public virtual ObjectResult<usp_GetUserTyeByAccountNumber_Result> usp_GetUserTyeByAccountNumber(Nullable<byte> iUserTypeId, Nullable<int> iLicenseId) |
... | ... | @@ -4990,5 +4994,22 @@ namespace AIAHTML5.ADMIN.API.Entity |
4990 | 4994 | |
4991 | 4995 | return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_InsertAIAUser", sLoginIdParameter, sPasswordParameter, sFirstnameParameter, sLastnameParameter, iUserTypeIdParameter, sEmailIdParameter, iSecurityQuesIdParameter, sSecurityAnswerParameter, iCreatorIdParameter, iLicenseIdParameter, iEditionIdParameter, status); |
4992 | 4996 | } |
4997 | + | |
4998 | + public virtual ObjectResult<Nullable<bool>> usp_ManageUserLoginStatus(Nullable<int> userId, string tag, Nullable<bool> isAlreadyLogin) | |
4999 | + { | |
5000 | + var userIdParameter = userId.HasValue ? | |
5001 | + new ObjectParameter("userId", userId) : | |
5002 | + new ObjectParameter("userId", typeof(int)); | |
5003 | + | |
5004 | + var tagParameter = tag != null ? | |
5005 | + new ObjectParameter("tag", tag) : | |
5006 | + new ObjectParameter("tag", typeof(string)); | |
5007 | + | |
5008 | + var isAlreadyLoginParameter = isAlreadyLogin.HasValue ? | |
5009 | + new ObjectParameter("isAlreadyLogin", isAlreadyLogin) : | |
5010 | + new ObjectParameter("isAlreadyLogin", typeof(bool)); | |
5011 | + | |
5012 | + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Nullable<bool>>("usp_ManageUserLoginStatus", userIdParameter, tagParameter, isAlreadyLoginParameter); | |
5013 | + } | |
4993 | 5014 | } |
4994 | 5015 | } | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Designer.cs
1 | -// T4 code generation is enabled for model 'E:\AIAProject00-SOURCECODE\AIAHTML5.ADMIN.API\Entity\AIADBEntity.edmx'. | |
1 | +// T4 code generation is enabled for model 'F:\AIAProject00-SOURCECODE\AIAHTML5.ADMIN.API\Entity\AIADBEntity.edmx'. | |
2 | 2 | // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer |
3 | 3 | // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model |
4 | 4 | // is open in the designer. | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx
... | ... | @@ -1228,6 +1228,7 @@ |
1228 | 1228 | <Parameter Name="iUserTypeId" Type="int" Mode="In" /> |
1229 | 1229 | <Parameter Name="iAccountTypeId" Type="int" Mode="In" /> |
1230 | 1230 | <Parameter Name="iLoginUserType" Type="int" Mode="In" /> |
1231 | + <Parameter Name="iLoginStatus" Type="bit" Mode="In" /> | |
1231 | 1232 | <Parameter Name="pageNo" Type="int" Mode="In" /> |
1232 | 1233 | <Parameter Name="pageLength" Type="int" Mode="In" /> |
1233 | 1234 | <Parameter Name="recordCount" Type="int" Mode="InOut" /> |
... | ... | @@ -1406,6 +1407,11 @@ |
1406 | 1407 | <Parameter Name="SiteEditionIds" Type="varchar" Mode="In" /> |
1407 | 1408 | <Parameter Name="Status" Type="int" Mode="InOut" /> |
1408 | 1409 | </Function> |
1410 | + <Function Name="usp_ManageUserLoginStatus" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> | |
1411 | + <Parameter Name="userId" Type="int" Mode="In" /> | |
1412 | + <Parameter Name="tag" Type="varchar" Mode="In" /> | |
1413 | + <Parameter Name="isAlreadyLogin" Type="bit" Mode="In" /> | |
1414 | + </Function> | |
1409 | 1415 | <Function Name="usp_SaveLabExerciseAttempts" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> |
1410 | 1416 | <Parameter Name="UserId" Type="int" Mode="In" /> |
1411 | 1417 | <Parameter Name="LabExerciseIdentifier" Type="nchar" Mode="In" /> |
... | ... | @@ -2843,6 +2849,7 @@ |
2843 | 2849 | <Parameter Name="iUserTypeId" Mode="In" Type="Int32" /> |
2844 | 2850 | <Parameter Name="iAccountTypeId" Mode="In" Type="Int32" /> |
2845 | 2851 | <Parameter Name="iLoginUserType" Mode="In" Type="Int32" /> |
2852 | + <Parameter Name="iLoginStatus" Mode="In" Type="Boolean" /> | |
2846 | 2853 | <Parameter Name="pageNo" Mode="In" Type="Int32" /> |
2847 | 2854 | <Parameter Name="pageLength" Mode="In" Type="Int32" /> |
2848 | 2855 | <Parameter Name="recordCount" Mode="InOut" Type="Int32" /> |
... | ... | @@ -2996,6 +3003,11 @@ |
2996 | 3003 | <Parameter Name="iEditionId" Mode="In" Type="Byte" /> |
2997 | 3004 | <Parameter Name="Status" Mode="InOut" Type="Int32" /> |
2998 | 3005 | </FunctionImport> |
3006 | + <FunctionImport Name="usp_ManageUserLoginStatus" ReturnType="Collection(Boolean)"> | |
3007 | + <Parameter Name="userId" Mode="In" Type="Int32" /> | |
3008 | + <Parameter Name="tag" Mode="In" Type="String" /> | |
3009 | + <Parameter Name="isAlreadyLogin" Mode="In" Type="Boolean" /> | |
3010 | + </FunctionImport> | |
2999 | 3011 | </EntityContainer> |
3000 | 3012 | <ComplexType Name="DA_GetBaseLayer_Result"> |
3001 | 3013 | <Property Type="Int32" Name="Id" Nullable="false" /> |
... | ... | @@ -4318,6 +4330,8 @@ |
4318 | 4330 | <Property Type="String" Name="UserStatus" Nullable="true" MaxLength="8" /> |
4319 | 4331 | <Property Type="Int32" Name="UserTypeId" Nullable="true" /> |
4320 | 4332 | <Property Type="Int32" Name="EditionTypeId" Nullable="true" /> |
4333 | + <Property Type="Boolean" Name="LoginStatus" Nullable="true" /> | |
4334 | + <Property Type="String" Name="TotalLogin" Nullable="true" MaxLength="50" /> | |
4321 | 4335 | </ComplexType> |
4322 | 4336 | <ComplexType Name="usp_GetUserTyeByAccountNumber_Result"> |
4323 | 4337 | <Property Type="Byte" Name="Id" Nullable="true" /> |
... | ... | @@ -6284,6 +6298,8 @@ |
6284 | 6298 | <ScalarProperty Name="UserStatus" ColumnName="UserStatus" /> |
6285 | 6299 | <ScalarProperty Name="UserTypeId" ColumnName="UserTypeId" /> |
6286 | 6300 | <ScalarProperty Name="EditionTypeId" ColumnName="EditionTypeId" /> |
6301 | + <ScalarProperty Name="LoginStatus" ColumnName="LoginStatus" /> | |
6302 | + <ScalarProperty Name="TotalLogin" ColumnName="TotalLogin" /> | |
6287 | 6303 | </ComplexTypeMapping> |
6288 | 6304 | </ResultMapping> |
6289 | 6305 | </FunctionImportMapping> |
... | ... | @@ -6305,6 +6321,7 @@ |
6305 | 6321 | <FunctionImportMapping FunctionImportName="usp_UpdateLicenseAccount" FunctionName="AIADatabaseV5Model.Store.usp_UpdateLicenseAccount" /> |
6306 | 6322 | <FunctionImportMapping FunctionImportName="usp_UpdateUserProfile" FunctionName="AIADatabaseV5Model.Store.usp_UpdateUserProfile" /> |
6307 | 6323 | <FunctionImportMapping FunctionImportName="usp_InsertAIAUser" FunctionName="AIADatabaseV5Model.Store.usp_InsertAIAUser" /> |
6324 | + <FunctionImportMapping FunctionImportName="usp_ManageUserLoginStatus" FunctionName="AIADatabaseV5Model.Store.usp_ManageUserLoginStatus" /> | |
6308 | 6325 | </EntityContainerMapping> |
6309 | 6326 | </Mapping> |
6310 | 6327 | </edmx:Mappings> | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUsersList_Result.cs
... | ... | @@ -29,5 +29,7 @@ namespace AIAHTML5.ADMIN.API.Entity |
29 | 29 | public string UserStatus { get; set; } |
30 | 30 | public Nullable<int> UserTypeId { get; set; } |
31 | 31 | public Nullable<int> EditionTypeId { get; set; } |
32 | + public Nullable<bool> LoginStatus { get; set; } | |
33 | + public string TotalLogin { get; set; } | |
32 | 34 | } |
33 | 35 | } | ... | ... |
400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs
... | ... | @@ -65,6 +65,21 @@ namespace AIAHTML5.ADMIN.API.Models |
65 | 65 | return false; |
66 | 66 | } |
67 | 67 | } |
68 | + public static bool ManageUserLoginStatus(AIADatabaseV5Entities dbContext, int userId, string tagName, bool isAlreadyLoggedIn) | |
69 | + { | |
70 | + bool loginStatus = false; | |
71 | + try | |
72 | + { | |
73 | + loginStatus = Convert.ToBoolean(dbContext.usp_ManageUserLoginStatus(userId, tagName, isAlreadyLoggedIn).FirstOrDefault()); | |
74 | + | |
75 | + return loginStatus; | |
76 | + } | |
77 | + catch (Exception ex) | |
78 | + { | |
79 | + throw new Exception(); | |
80 | + } | |
81 | + } | |
82 | + | |
68 | 83 | public static string UpdateUserId(AIADatabaseV5Entities dbContext, int id, string userId, string oldUserId) |
69 | 84 | { |
70 | 85 | var spStatus = new System.Data.Objects.ObjectParameter("Status", 0); | ... | ... |
400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs
... | ... | @@ -41,5 +41,6 @@ namespace AIAHTML5.API.Constants |
41 | 41 | public const string GET_COUNT_EXPORTED_IMAGE = "usp_GetCountExportedImage"; |
42 | 42 | public const string INSERT_EXPORTED_IMAGE = "usp_InsertExportedImage"; |
43 | 43 | public const string GET_USER_DETAIL_BYLOGIN_AND_ACCOUNT = "usp_GetUserDetailsByLoginIdandAccount"; |
44 | + public const string GET_USER_LOGIN_STATUS = "usp_ManageUserLoginStatus"; | |
44 | 45 | } |
45 | 46 | } |
46 | 47 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
... | ... | @@ -502,6 +502,28 @@ namespace AIAHTML5.API.Controllers |
502 | 502 | return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); |
503 | 503 | } |
504 | 504 | } |
505 | + | |
506 | + [HttpPost] | |
507 | + [Route("api/ManageUserLoginStatus")] | |
508 | + public HttpResponseMessage ManageUserLoginStatus([FromBody]JObject jsonData) | |
509 | + { | |
510 | + string loginStatus = string.Empty; | |
511 | + try | |
512 | + { | |
513 | + int userId = jsonData["userId"].Value<int>(); | |
514 | + string tagName = jsonData["tagName"].Value<string>(); | |
515 | + bool isAlreadyLoggedIn = jsonData["isAlreadyLoggedIn"].Value<bool>(); | |
516 | + | |
517 | + loginStatus = AIAHTML5.API.Models.Users.GetUserLoginStatus(userId, tagName, isAlreadyLoggedIn); | |
518 | + | |
519 | + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(loginStatus) }; | |
520 | + } | |
521 | + catch (Exception ex) | |
522 | + { | |
523 | + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); | |
524 | + } | |
525 | + } | |
526 | + | |
505 | 527 | // PUT api/authenticate/5 |
506 | 528 | public void Put(int id, [FromBody]string value) |
507 | 529 | { | ... | ... |
400-SOURCECODE/AIAHTML5.API/Controllers/ConfigurationController.cs
... | ... | @@ -18,6 +18,9 @@ namespace AIAHTML5.API.Controllers |
18 | 18 | dynamic responseData; |
19 | 19 | MyConfig mconfig = new MyConfig(); |
20 | 20 | mconfig.current_year= DateTime.Now.Year; |
21 | + mconfig.idleTime = Int32.Parse(ConfigurationManager.AppSettings["IDLE_TIME"]); | |
22 | + mconfig.idelTimeOut = Int32.Parse(ConfigurationManager.AppSettings["IDLE_TIME_OUT"]); | |
23 | + mconfig.pingInterval = Int32.Parse(ConfigurationManager.AppSettings["PING_INTERVAL"]); | |
21 | 24 | mconfig.serverPath = ConfigurationManager.AppSettings["ANIMATION_HOSTING_SERVER"]; |
22 | 25 | mconfig.fileSize = Int32.Parse(ConfigurationManager.AppSettings["UploadMaxFileSize"]); |
23 | 26 | |
... | ... | @@ -30,6 +33,9 @@ namespace AIAHTML5.API.Controllers |
30 | 33 | public class MyConfig |
31 | 34 | { |
32 | 35 | public int current_year { get; set; } |
36 | + public int idleTime { get; set; } | |
37 | + public int idelTimeOut { get; set; } | |
38 | + public int pingInterval { get; set; } | |
33 | 39 | public string serverPath { get; set; } |
34 | 40 | public int fileSize { get; set; } |
35 | 41 | } |
36 | 42 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... | ... | @@ -348,6 +348,42 @@ namespace AIAHTML5.API.Models |
348 | 348 | return objUser; |
349 | 349 | } |
350 | 350 | |
351 | + internal static string GetUserLoginStatus(int userId,string tagName,bool isAlreadyLoggedIn) | |
352 | + { | |
353 | + string status=string.Empty; | |
354 | + DBModel objModel = new DBModel(); | |
355 | + | |
356 | + SqlConnection conn = new SqlConnection(dbConnectionString); | |
357 | + SqlCommand cmd = new SqlCommand(); | |
358 | + SqlDataAdapter adapter; | |
359 | + DataSet ds = new DataSet(); | |
360 | + | |
361 | + cmd.Connection = conn; | |
362 | + cmd.CommandText = DBConstants.GET_USER_LOGIN_STATUS; | |
363 | + cmd.CommandType = CommandType.StoredProcedure; | |
364 | + cmd.Parameters.AddWithValue("@userId", userId); | |
365 | + cmd.Parameters.AddWithValue("@tag", tagName); | |
366 | + cmd.Parameters.AddWithValue("@isAlreadyLogin", isAlreadyLoggedIn); | |
367 | + adapter = new SqlDataAdapter(cmd); | |
368 | + adapter.Fill(ds); | |
369 | + | |
370 | + if (ds != null && ds.Tables.Count > 0) | |
371 | + { | |
372 | + DataTable dt = ds.Tables[0]; | |
373 | + | |
374 | + if (dt.Rows.Count > 0) | |
375 | + { | |
376 | + foreach (DataRow dr in dt.Rows) | |
377 | + { | |
378 | + status = dr["loginStatus"].ToString(); | |
379 | + | |
380 | + } | |
381 | + } | |
382 | + } | |
383 | + | |
384 | + return status; | |
385 | + } | |
386 | + | |
351 | 387 | internal User GetSelectedSettings(int userId) |
352 | 388 | { |
353 | 389 | logger.Debug(" Inside GetSelectedSettings for userId = " + userId); | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... | ... | @@ -315,6 +315,14 @@ namespace AIAHTML5.API.Models |
315 | 315 | return objUser; |
316 | 316 | } |
317 | 317 | |
318 | + internal static string GetUserLoginStatus(int userId, string tagName,bool isAlreadyLoggedIn) | |
319 | + { | |
320 | + string status = null; | |
321 | + status = DBModel.GetUserLoginStatus(userId, tagName, isAlreadyLoggedIn); | |
322 | + | |
323 | + return status; | |
324 | + } | |
325 | + | |
318 | 326 | internal static int SaveUserSelectedSettings(User selectedSettings) |
319 | 327 | { |
320 | 328 | logger.Debug("inside SaveUserSelectedSettings for Image =" + selectedSettings.Id); | ... | ... |
400-SOURCECODE/AIAHTML5.API/Web.config
... | ... | @@ -31,9 +31,16 @@ |
31 | 31 | </log4net> |
32 | 32 | |
33 | 33 | <appSettings> |
34 | + <!-- set Idel time 20 minute --> | |
35 | + <add key="IDLE_TIME" value="1200" /> | |
36 | + <!-- set idle timeout 30 seconds --> | |
37 | + <add key="IDLE_TIME_OUT" value="30" /> | |
38 | + <!-- set ping time interval 30 seconds --> | |
39 | + <add key="PING_INTERVAL" value="10" /> | |
40 | + | |
34 | 41 | <add key="ANIMATION_HOSTING_SERVER" value="~/../content/data/AnimationMp4/" /> |
35 | - <!-- set to 10mb upload file size for single file at a time --> | |
36 | - <add key="UploadMaxFileSize" value="10485760" /> | |
42 | + <!-- set to 10mb upload file size for single file at a time --> | |
43 | + <add key="UploadMaxFileSize" value="10485760" /> | |
37 | 44 | |
38 | 45 | <add key="SenderEmailAddress" value="support@interactiveanatomy.com" /> |
39 | 46 | <!--<add key="SenderEmailAddress" value="support@interactiveanatomy.com" />--> | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js
... | ... | @@ -179,7 +179,6 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location |
179 | 179 | var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json') |
180 | 180 | promise.then( |
181 | 181 | function (result) { |
182 | - | |
183 | 182 | var threeDAnatomyData = new jinqJs() |
184 | 183 | .from(result.root.ThreeDAData) |
185 | 184 | .orderBy([{ field: '_Title', sort: 'asc' }]) |
... | ... | @@ -493,7 +492,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location |
493 | 492 | $rootScope.ThreeDWindowLoadComplete = true; |
494 | 493 | } |
495 | 494 | $scope.JsPanelMouseEnter(windowviewid); |
496 | - | |
495 | + | |
497 | 496 | } |
498 | 497 | |
499 | 498 | $scope.JsPanelMouseEnter = function (windowviewid) { |
... | ... | @@ -502,6 +501,36 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location |
502 | 501 | //call when module loaded |
503 | 502 | $rootScope.resetMenuOption(); |
504 | 503 | |
504 | + var timeintval = null; | |
505 | + timeintval = $interval(PointerEventEnableDisable, 5000); | |
506 | + | |
507 | + function PointerEventEnableDisable() { | |
508 | + var pointevents = $("#threedImage_" + windowviewid).css('pointer-events'); | |
509 | + if (pointevents=='auto') { | |
510 | + $scope.stop3drefresh(timeintval); | |
511 | + timeintval = $interval(PointerEventEnableDisable, 500); | |
512 | + $("#threedImage_" + windowviewid).css('pointer-events', 'none'); | |
513 | + } | |
514 | + else if(pointevents=='none') | |
515 | + { | |
516 | + $("#threedImage_" + windowviewid).css('pointer-events', 'auto'); | |
517 | + $scope.stop3drefresh(timeintval); | |
518 | + timeintval = $interval(PointerEventEnableDisable, 5000); | |
519 | + } | |
520 | + else | |
521 | + { | |
522 | + //auto clode interval when panel close | |
523 | + $scope.stop3drefresh(timeintval); | |
524 | + } | |
525 | + } | |
526 | + | |
527 | + $scope.stop3drefresh = function (timeintval) { | |
528 | + if (angular.isDefined(timeintval)) { | |
529 | + $interval.cancel(timeintval); | |
530 | + timeintval = undefined; | |
531 | + } | |
532 | + }; | |
533 | + | |
505 | 534 | // call from while open module in CB |
506 | 535 | |
507 | 536 | //click event not work on object-tag document |
... | ... | @@ -514,7 +543,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location |
514 | 543 | |
515 | 544 | }); |
516 | 545 | |
517 | - } | |
546 | + } | |
518 | 547 | |
519 | 548 | $scope.RemoveJSPanel = function (panelid) { |
520 | 549 | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
1 | 1 | 'use strict'; |
2 | 2 | |
3 | -AIA.controller("HomeController", ["$rootScope", "$scope", "Modules", "$log", "$location", "$compile", "$timeout", "DataService", "AuthenticationService", "ConfigurationService", "LoginConstants", "UserModules", "LoginMessageConstants", "AdminService", "$http", "AdminConstants", "UserTypeConstants", "AIAConstants","ModuleService","$window", | |
4 | -function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, DataService, AuthenticationService, ConfigurationService, LoginConstants, UserModules, LoginMessageConstants, AdminService, $http, AdminConstants, UserTypeConstants, AIAConstants, ModuleService,$window) { | |
3 | +AIA.controller("HomeController", ["$rootScope", "$scope", "Modules", "$log", "$location", "$compile", "$timeout", "DataService", "AuthenticationService", "ConfigurationService", "LoginConstants", "UserModules", "LoginMessageConstants", "AdminService", "$http", "AdminConstants", "UserTypeConstants", "AIAConstants","ModuleService","$window","Idle", "Keepalive", | |
4 | +function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, DataService, AuthenticationService, ConfigurationService, LoginConstants, UserModules, LoginMessageConstants, AdminService, $http, AdminConstants, UserTypeConstants, AIAConstants, ModuleService,$window,Idle, Keepalive) { | |
5 | 5 | |
6 | 6 | //$scope.pageToOpen = { |
7 | 7 | // name: 'MainMenu' |
8 | 8 | //}; |
9 | 9 | |
10 | 10 | $rootScope.MULTI_VIEW_ID = 401; |
11 | - | |
12 | 11 | $rootScope.pageToOpen = 'app/widget/MainMenu.html'; |
13 | 12 | $rootScope.currentBodyViewId; |
14 | 13 | $rootScope.currentActiveModuleTitle = 'Welcome to A.D.A.M. Interactive Anatomy';//Modules[0].Name; |
... | ... | @@ -667,8 +666,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
667 | 666 | if (navigator.cookieEnabled) { |
668 | 667 | |
669 | 668 | $rootScope.isLoading = false; |
670 | - | |
671 | - | |
669 | + $rootScope.isLoginLoading = false; | |
670 | + | |
672 | 671 | //unblock user |
673 | 672 | if (url.indexOf('?unb:') != -1) { |
674 | 673 | |
... | ... | @@ -688,8 +687,56 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
688 | 687 | //get user is already loggedin or not |
689 | 688 | $scope.currentUserDetails = $rootScope.getLocalStorageValue('loggedInUserDetails'); |
690 | 689 | if ($scope.currentUserDetails != undefined) { |
691 | - AuthenticateAlreadyLoggedInUser(); | |
690 | + $rootScope.isVisibleLogin = false; | |
691 | + ConfigurationService.getCofigValue() | |
692 | + .then( | |
693 | + function (configresult) { | |
694 | + $rootScope.current_year = configresult.current_year; | |
695 | + $rootScope.aiaIdleTime = configresult.idleTime; | |
696 | + $rootScope.aiaIdleTimeOut = configresult.idelTimeOut; | |
697 | + $rootScope.aiaPingInterval = configresult.pingInterval; | |
698 | + $rootScope.aiaAnimationPath = configresult.serverPath; | |
699 | + $rootScope.MaxOneFileSize = configresult.fileSize; | |
700 | + var loggedInUser = JSON.parse($scope.currentUserDetails); | |
701 | + //incase site user login userid is 0 so then using license id | |
702 | + //logout site user while reload url without parameter | |
703 | + var userId=loggedInUser.Id==0?loggedInUser.LicenseId:loggedInUser.Id; | |
704 | + $scope.checkuserstatus = { | |
705 | + userId: userId, | |
706 | + tagName: loggedInUser.Id==0?'logout':'update', | |
707 | + isAlreadyLoggedIn:true | |
708 | + } | |
709 | + | |
710 | + // this case found when browser closed by user after login. after long time (after 20 min) open site again | |
711 | + // loggedInUserDetails contain user detail so user auto login but it is logout by | |
712 | + // 1.by agent job 2. or by admin section from db | |
713 | + // so check user session again before auto login | |
714 | + AuthenticationService.ManageUserLoginStatus($scope.checkuserstatus) | |
715 | + .then( | |
716 | + function (loginStatus) { | |
717 | + if(loginStatus!=null) | |
718 | + { | |
719 | + if(loginStatus=='False') | |
720 | + { | |
721 | + $rootScope.LogoutUserSession(); | |
722 | + } | |
723 | + else | |
724 | + { | |
725 | + AuthenticateAlreadyLoggedInUser(); | |
726 | + } | |
727 | + } | |
728 | + | |
729 | + }), | |
730 | + function (error) { | |
731 | + console.log(' Error in user login status = ' + error.statusText); | |
732 | + $rootScope.errorMessage = error; | |
733 | + $("#messageModal").modal('show'); | |
734 | + } | |
735 | + | |
736 | + }); | |
737 | + | |
692 | 738 | } |
739 | + | |
693 | 740 | var isRememberChecked = $rootScope.getLocalStorageValue('isRememberMeChecked'); |
694 | 741 | |
695 | 742 | if ($rootScope.getLocalStorageValue('isRememberMeChecked') != "" && sessionStorage.getItem("loginSession") == null) { |
... | ... | @@ -703,7 +750,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
703 | 750 | } |
704 | 751 | } |
705 | 752 | } |
706 | - | |
707 | 753 | else { |
708 | 754 | |
709 | 755 | $rootScope.isVisibleLogin = true; |
... | ... | @@ -711,26 +757,45 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
711 | 757 | $rootScope.promptUserForCookies(); |
712 | 758 | } |
713 | 759 | |
760 | + $scope.currentUserDetails = $rootScope.getLocalStorageValue('loggedInUserDetails'); | |
761 | + if ($scope.currentUserDetails == undefined) { | |
714 | 762 | $rootScope.getConfigurationValues(); |
763 | + } | |
715 | 764 | } |
716 | 765 | |
717 | 766 | $timeout(function () { |
718 | 767 | $scope.helpTopicLink(); |
719 | 768 | }, 2000); |
720 | 769 | |
721 | - | |
722 | 770 | } |
723 | 771 | $rootScope.getConfigurationValues = function () { |
724 | 772 | ConfigurationService.getCofigValue() |
725 | 773 | .then( |
726 | 774 | function (configresult) { |
727 | 775 | $rootScope.current_year = configresult.current_year; |
776 | + $rootScope.aiaIdleTime = configresult.idleTime; | |
777 | + $rootScope.aiaIdleTimeOut = configresult.idelTimeOut; | |
778 | + $rootScope.aiaPingInterval = configresult.pingInterval; | |
728 | 779 | $rootScope.aiaAnimationPath = configresult.serverPath; |
729 | 780 | $rootScope.MaxOneFileSize = configresult.fileSize; |
730 | 781 | |
731 | 782 | }); |
732 | 783 | } |
733 | - $rootScope.AuthenticateUser = function (userInfo) { | |
784 | + $rootScope.LoginEnableUI=function() | |
785 | + { | |
786 | + $rootScope.isLoginLoading = false; | |
787 | + $('#spinnerLogin').css('visibility', 'hidden'); | |
788 | + $('.loginPanel').css('pointer-events', 'auto'); | |
789 | + $('.loginPanel').css('opacity', '1'); | |
790 | + } | |
791 | + $rootScope.LoginDisableUI=function() | |
792 | + { | |
793 | + $rootScope.isLoginLoading = true; | |
794 | + $('#spinnerLogin').css('visibility', 'visible'); | |
795 | + $('.loginPanel').css('pointer-events', 'none'); | |
796 | + $('.loginPanel').css('opacity', '0.7'); | |
797 | + } | |
798 | + $rootScope.AuthenticateUser = function (userInfo,isAlreadyLoggedIn) { | |
734 | 799 | if (navigator.cookieEnabled) { |
735 | 800 | $rootScope.errorMessage = ""; |
736 | 801 | if (userInfo.username == "" || userInfo.username == null || userInfo.username == undefined || userInfo.password == "" || userInfo.password == null || userInfo.password == undefined) { |
... | ... | @@ -741,13 +806,14 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
741 | 806 | } |
742 | 807 | else { |
743 | 808 | |
744 | - | |
809 | + $rootScope.LoginDisableUI(); | |
745 | 810 | AuthenticationService.authenticateUser(userInfo) |
746 | 811 | .then( |
747 | 812 | |
748 | 813 | function (result) { |
749 | - | |
750 | - if (result == LoginConstants.USER_NOT_FOUND) { | |
814 | + | |
815 | + if (result == LoginConstants.USER_NOT_FOUND) { | |
816 | + $rootScope.LoginEnableUI(); | |
751 | 817 | $rootScope.isVisibleLogin = true; |
752 | 818 | // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT); |
753 | 819 | $rootScope.errorMessage = LoginMessageConstants.INVALID_USER; |
... | ... | @@ -757,6 +823,14 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
757 | 823 | |
758 | 824 | // birendra// initialize exp img detail object |
759 | 825 | $rootScope.initializeUserForExportImage(result.Id); |
826 | + // update result with session detail | |
827 | + result.aiaIdleTime=$rootScope.aiaIdleTime; | |
828 | + result.aiaIdleTimeOut=$rootScope.aiaIdleTimeOut; | |
829 | + result.aiaPingInterval=$rootScope.aiaPingInterval; | |
830 | + $rootScope.isAlreadyLoggedIn=isAlreadyLoggedIn==undefined?false:isAlreadyLoggedIn; | |
831 | + //display user name | |
832 | + $rootScope.userName=result.FirstName+" "+result.LastName; | |
833 | + | |
760 | 834 | |
761 | 835 | //code for modesty setting |
762 | 836 | if (result.LicenseInfo != null) { |
... | ... | @@ -830,61 +904,70 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
830 | 904 | } |
831 | 905 | if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_PASSWORD_NOT_MATCH) { |
832 | 906 | $rootScope.isVisibleLogin = true; |
907 | + $rootScope.LoginEnableUI(); | |
833 | 908 | $rootScope.errorMessage = LoginMessageConstants.INVALID_PASSWORD; |
834 | 909 | $("#messageModal").modal('show'); |
835 | 910 | } |
836 | 911 | else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_ID_BLOCKED_24_HRS) { |
837 | 912 | $rootScope.isVisibleLogin = true; |
913 | + $rootScope.LoginEnableUI(); | |
838 | 914 | $rootScope.errorMessage = LoginMessageConstants.USER_BLOCKED; |
839 | 915 | $("#messageModal").modal('show'); |
840 | 916 | } |
841 | 917 | else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) { |
842 | 918 | $rootScope.isVisibleLogin = true; |
919 | + $rootScope.LoginEnableUI(); | |
843 | 920 | $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; |
844 | 921 | $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; |
845 | 922 | $("#messageModal").modal('show'); |
846 | 923 | } |
847 | 924 | else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) { |
848 | 925 | $rootScope.isVisibleLogin = true; |
926 | + $rootScope.LoginEnableUI(); | |
849 | 927 | $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; |
850 | 928 | $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; |
851 | 929 | $("#messageModal").modal('show'); |
852 | 930 | } |
853 | 931 | else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) { |
854 | 932 | $rootScope.isVisibleLogin = true; |
933 | + $rootScope.LoginEnableUI(); | |
855 | 934 | $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; |
856 | 935 | $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; |
857 | 936 | $("#messageModal").modal('show'); |
858 | 937 | } |
859 | 938 | else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) { |
860 | 939 | $rootScope.isVisibleLogin = true; |
940 | + $rootScope.LoginEnableUI(); | |
861 | 941 | $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; |
862 | 942 | $("#messageModal").modal('show'); |
863 | 943 | } |
864 | 944 | else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) { |
865 | 945 | $rootScope.isVisibleLogin = true; |
946 | + $rootScope.LoginEnableUI(); | |
866 | 947 | $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE; |
867 | 948 | $("#messageModal").modal('show'); |
868 | 949 | } |
869 | 950 | else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) { |
870 | 951 | $rootScope.isVisibleLogin = true; |
952 | + $rootScope.LoginEnableUI(); | |
871 | 953 | $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; |
872 | 954 | $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; |
873 | 955 | $("#messageModal").modal('show'); |
874 | 956 | } |
875 | 957 | else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) { |
876 | 958 | $rootScope.isVisibleLogin = true; |
959 | + $rootScope.LoginEnableUI(); | |
877 | 960 | $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; |
878 | 961 | $("#messageModal").modal('show'); |
879 | 962 | } |
880 | 963 | else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) { |
881 | 964 | $rootScope.isVisibleLogin = true; |
965 | + $rootScope.LoginEnableUI(); | |
882 | 966 | $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; |
883 | 967 | $("#messageModal").modal('show'); |
884 | 968 | } |
885 | 969 | else { |
886 | 970 | |
887 | - | |
888 | 971 | //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true |
889 | 972 | if (result.LicenseId == 0 && result.IsActive) { |
890 | 973 | |
... | ... | @@ -899,10 +982,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
899 | 982 | $rootScope.userData = result; |
900 | 983 | $rootScope.userModules = result.Modules; |
901 | 984 | |
902 | - if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") { | |
903 | - localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); | |
904 | - } | |
905 | - | |
985 | + localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); | |
986 | + | |
906 | 987 | if (isCommingSoonModel == true) { |
907 | 988 | |
908 | 989 | // ShowAssignedModulesPopup(result.Modules); |
... | ... | @@ -922,6 +1003,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
922 | 1003 | $location.path('/'); |
923 | 1004 | |
924 | 1005 | $timeout(function () { |
1006 | + $rootScope.LoginEnableUI(); | |
925 | 1007 | $scope.RedirectToModule(); |
926 | 1008 | }, 100); |
927 | 1009 | |
... | ... | @@ -938,19 +1020,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
938 | 1020 | if (result.UserTypeId == 8) { |
939 | 1021 | |
940 | 1022 | $rootScope.haveRoleAdmin = false; |
941 | - } | |
942 | - | |
943 | - // Remove Admin Link for LicenseEditionId 3/4 of student | |
944 | - if (result.EditionId == 3 || result.EditionId == 4) { | |
945 | - $rootScope.haveRoleAdmin = false; | |
946 | - | |
947 | - } | |
948 | - | |
949 | - if (result.UserTypeId == 6) { | |
950 | - $('#modestyDiv').css('pointerEvent', 'none'); | |
951 | - $('#modestyDiv').css('opacity', 0.4); | |
952 | - $("#modestyDiv").find("*").prop('disabled', true); | |
953 | - } | |
1023 | + } | |
954 | 1024 | |
955 | 1025 | if (result.LicenseInfo != null) { |
956 | 1026 | |
... | ... | @@ -973,19 +1043,21 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
973 | 1043 | |
974 | 1044 | |
975 | 1045 | if (result.LicenseInfo.IsTermAccepted) { |
976 | - | |
977 | 1046 | //0. |
978 | 1047 | $rootScope.userData = result; |
979 | 1048 | $rootScope.userModules = result.Modules; |
980 | 1049 | |
981 | - $("#modestyDiv").css("pointer-events", "none"); | |
982 | - $("#modestyDiv").css("opacity", 0.5); | |
983 | - //2. | |
984 | - if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") { | |
985 | - | |
986 | - localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); | |
987 | - } | |
988 | - | |
1050 | + //only instructor allowed to change modesty | |
1051 | + //concurrent user of non-instructor | |
1052 | + if( result.UserTypeId == 6 && result.EditionId!=1 && result.EditionId!=2) | |
1053 | + { | |
1054 | + $("#modestyDiv").css("pointer-events", "none"); | |
1055 | + $("#modestyDiv").css("opacity", 0.5); | |
1056 | + $("#modestyDiv").find("*").prop('disabled', true); | |
1057 | + } | |
1058 | + | |
1059 | + localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); | |
1060 | + | |
989 | 1061 | // 3.ShowAssignedModulesPopup |
990 | 1062 | //isCommingSoonModel =true only when user comes first time on application and login |
991 | 1063 | if (isCommingSoonModel == true) { |
... | ... | @@ -1006,10 +1078,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1006 | 1078 | //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 |
1007 | 1079 | localStorage.setItem('isCommingSoonModel', false); |
1008 | 1080 | |
1009 | - // for reseller type user first need to update profile | |
1010 | - // only instructor ,not student | |
1011 | - if (result.UserTypeId == 7 && result.EditionId == 1 && (result.FirstName == "" || result.EmailId == "" || result.LastName == "")) { | |
1012 | - | |
1081 | + // for reseller type user first need to update profile | |
1082 | + if (result.UserTypeId == 7 && (result.FirstName == "" || result.EmailId == "" || result.LastName == "")) { | |
1083 | + $rootScope.LoginEnableUI(); | |
1013 | 1084 | $('#updateprofile').html(LoginMessageConstants.USER_UPDATE_PROFILE); |
1014 | 1085 | |
1015 | 1086 | $("#profileUpdateModal").modal('show'); |
... | ... | @@ -1020,6 +1091,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1020 | 1091 | else { |
1021 | 1092 | $location.path('/'); |
1022 | 1093 | $timeout(function () { |
1094 | + $rootScope.LoginEnableUI(); | |
1023 | 1095 | $scope.RedirectToModule(); |
1024 | 1096 | |
1025 | 1097 | }, 100); |
... | ... | @@ -1030,6 +1102,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1030 | 1102 | $('#dvTerms').html(result.TermsAndConditionsText); |
1031 | 1103 | } |
1032 | 1104 | $rootScope.isVisibleLogin = true; |
1105 | + $rootScope.LoginEnableUI(); | |
1033 | 1106 | $('#dvTermCondition').fadeIn(); |
1034 | 1107 | $rootScope.userData = result; |
1035 | 1108 | localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); |
... | ... | @@ -1040,6 +1113,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1040 | 1113 | |
1041 | 1114 | } |
1042 | 1115 | |
1116 | + // set user session time | |
1117 | + $rootScope.loadUserSession(); | |
1118 | + $rootScope.LoginEnableUI(); | |
1043 | 1119 | } |
1044 | 1120 | |
1045 | 1121 | } |
... | ... | @@ -1049,6 +1125,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1049 | 1125 | function (error) { |
1050 | 1126 | console.log(' Error in authentication = ' + error.statusText); |
1051 | 1127 | // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); |
1128 | + $rootScope.LoginEnableUI(); | |
1052 | 1129 | $rootScope.isVisibleLogin = true; |
1053 | 1130 | $rootScope.errorMessage = error; |
1054 | 1131 | $("#messageModal").modal('show'); |
... | ... | @@ -1169,19 +1246,43 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1169 | 1246 | if (isCalsCredantialForSIte == "True") { |
1170 | 1247 | if($rootScope.siteUrlInfo.mtype!=null && $rootScope.siteUrlInfo.mtype.toLowerCase()=='ca' && $rootScope.siteUrlInfo.userId!=null && $rootScope.siteUrlInfo.accountNumber!=null) |
1171 | 1248 | { |
1249 | + $rootScope.LoginDisableUI(); | |
1172 | 1250 | AuthenticationService.ByPassLoginToOpenModule($rootScope.siteUrlInfo) |
1173 | 1251 | .then( |
1174 | 1252 | function (result) { |
1175 | 1253 | if(result!=null) |
1176 | - { | |
1177 | - $rootScope.userInfo.username = result.LoginId; | |
1178 | - $rootScope.userInfo.password = result.Password; | |
1179 | - $rootScope.AuthenticateUser($rootScope.userInfo); | |
1254 | + { | |
1255 | + $scope.currentUserDetails = $rootScope.getLocalStorageValue('loggedInUserDetails'); | |
1256 | + ConfigurationService.getCofigValue() | |
1257 | + .then( | |
1258 | + function (configresult) { | |
1259 | + $rootScope.current_year = configresult.current_year; | |
1260 | + $rootScope.aiaIdleTime = configresult.idleTime; | |
1261 | + $rootScope.aiaIdleTimeOut = configresult.idelTimeOut; | |
1262 | + $rootScope.aiaPingInterval = configresult.pingInterval; | |
1263 | + $rootScope.aiaAnimationPath = configresult.serverPath; | |
1264 | + $rootScope.MaxOneFileSize = configresult.fileSize; | |
1265 | + | |
1266 | + $rootScope.userInfo.username = result.LoginId; | |
1267 | + $rootScope.userInfo.password = result.Password; | |
1268 | + var loggedInUser = JSON.parse($scope.currentUserDetails); | |
1269 | + if(loggedInUser!==null && loggedInUser.LoginId==result.LoginId) | |
1270 | + { | |
1271 | + $rootScope.AuthenticateUser($rootScope.userInfo,true); | |
1272 | + } | |
1273 | + else | |
1274 | + { | |
1275 | + $rootScope.AuthenticateUser($rootScope.userInfo,false); | |
1276 | + } | |
1277 | + }); | |
1278 | + | |
1180 | 1279 | } |
1181 | 1280 | |
1182 | 1281 | }), |
1183 | 1282 | function (error) { |
1184 | 1283 | console.log(' Error in bypass login = ' + error.statusText); |
1284 | + $rootScope.isVisibleLogin = true; | |
1285 | + $rootScope.LoginEnableUI(); | |
1185 | 1286 | $rootScope.errorMessage = error; |
1186 | 1287 | $("#messageModal").modal('show'); |
1187 | 1288 | } |
... | ... | @@ -1190,59 +1291,98 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1190 | 1291 | else |
1191 | 1292 | { |
1192 | 1293 | console.log(' invalid detail in bypass login'); |
1294 | + $rootScope.isVisibleLogin = true; | |
1193 | 1295 | $rootScope.errorMessage = "authentication is not allowed due to invalid details format .\nPlease pass the correct details again!"; |
1194 | 1296 | $("#messageModal").modal('show'); |
1195 | 1297 | } |
1196 | 1298 | |
1197 | 1299 | } |
1198 | 1300 | else { |
1301 | + | |
1302 | + console.log($rootScope.siteUrlInfo); | |
1303 | + | |
1304 | + $rootScope.LoginDisableUI(); | |
1305 | + $scope.currentUserDetails = $rootScope.getLocalStorageValue('loggedInUserDetails'); | |
1306 | + var sitedetail=$rootScope.siteUrlInfo; | |
1307 | + ConfigurationService.getCofigValue() | |
1308 | + .then( | |
1309 | + function (configresult) { | |
1310 | + $rootScope.current_year = configresult.current_year; | |
1311 | + $rootScope.aiaIdleTime = configresult.idleTime; | |
1312 | + $rootScope.aiaIdleTimeOut = configresult.idelTimeOut; | |
1313 | + $rootScope.aiaPingInterval = configresult.pingInterval; | |
1314 | + $rootScope.aiaAnimationPath = configresult.serverPath; | |
1315 | + $rootScope.MaxOneFileSize = configresult.fileSize; | |
1316 | + | |
1317 | + var loggedInUser = JSON.parse($scope.currentUserDetails); | |
1318 | + //check already login by account number bcz no login id for site login | |
1319 | + //maintain user session by licenseid of site login | |
1320 | + if(loggedInUser!==null && loggedInUser.AccountNumber==sitedetail.accountNumber) | |
1321 | + { | |
1322 | + $rootScope.AuthenticateClientSiteUser(sitedetail,true); | |
1323 | + } | |
1324 | + else | |
1325 | + { | |
1326 | + $rootScope.AuthenticateClientSiteUser(sitedetail,false); | |
1327 | + } | |
1328 | + }); | |
1329 | + } | |
1330 | + } | |
1199 | 1331 | |
1200 | - console.log($rootScope.siteUrlInfo); | |
1201 | - | |
1202 | - AuthenticationService.validateClientSite($rootScope.siteUrlInfo) | |
1332 | + $rootScope.AuthenticateClientSiteUser = function (siteInfo,isAlreadyLoggedIn) { | |
1333 | + AuthenticationService.validateClientSite(siteInfo) | |
1203 | 1334 | .then( |
1204 | - | |
1205 | 1335 | function (result) { |
1206 | - | |
1207 | - console.log(result); | |
1336 | + console.log(result); | |
1208 | 1337 | if (result != null) { |
1209 | - | |
1210 | - | |
1211 | 1338 | console.log(result); |
1212 | 1339 | if (result == LoginConstants.INVALID_CLIENT) { |
1213 | 1340 | $rootScope.isVisibleLogin = true; |
1341 | + $rootScope.LoginEnableUI(); | |
1214 | 1342 | $rootScope.errorMessage = LoginConstants.INVALID_CLIENT; |
1215 | 1343 | $("#messageModal").modal('show'); |
1216 | 1344 | } |
1217 | 1345 | else if (result == LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER) { |
1218 | 1346 | $rootScope.isVisibleLogin = true; |
1347 | + $rootScope.LoginEnableUI(); | |
1219 | 1348 | $rootScope.errorMessage = LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER; |
1220 | 1349 | $("#messageModal").modal('show'); |
1221 | 1350 | } |
1222 | 1351 | |
1223 | 1352 | else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_ACCOUNT_NUMBER_NOT_NULL) { |
1224 | 1353 | $rootScope.isVisibleLogin = true; |
1354 | + $rootScope.LoginEnableUI(); | |
1225 | 1355 | $rootScope.errorMessage = LoginMessageConstants.E_ACCOUNT_NUMBER_NOT_NULL; |
1226 | 1356 | $("#messageModal").modal('show'); |
1227 | 1357 | } |
1228 | 1358 | else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_ID_NOT_NULL) { |
1229 | 1359 | $rootScope.isVisibleLogin = true; |
1360 | + $rootScope.LoginEnableUI(); | |
1230 | 1361 | $rootScope.errorMessage = LoginMessageConstants.E_EDITION_ID_NOT_NULL; |
1231 | 1362 | $("#messageModal").modal('show'); |
1232 | 1363 | } |
1233 | 1364 | else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_NOT_LINKED_WITH_SITE) { |
1234 | 1365 | $rootScope.isVisibleLogin = true; |
1366 | + $rootScope.LoginEnableUI(); | |
1235 | 1367 | $rootScope.errorMessage = LoginMessageConstants.E_EDITION_NOT_LINKED_WITH_SITE; |
1236 | 1368 | $("#messageModal").modal('show'); |
1237 | 1369 | } |
1238 | 1370 | else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.LICENSE_INACTIVE) { |
1239 | 1371 | $rootScope.isVisibleLogin = true; |
1372 | + $rootScope.LoginEnableUI(); | |
1240 | 1373 | $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; |
1241 | 1374 | $("#messageModal").modal('show'); |
1242 | 1375 | } |
1243 | 1376 | |
1244 | 1377 | |
1245 | 1378 | else { |
1379 | + // update result with session detail | |
1380 | + result.aiaIdleTime=$rootScope.aiaIdleTime; | |
1381 | + result.aiaIdleTimeOut=$rootScope.aiaIdleTimeOut; | |
1382 | + result.aiaPingInterval=$rootScope.aiaPingInterval; | |
1383 | + $rootScope.isAlreadyLoggedIn=isAlreadyLoggedIn==undefined?false:isAlreadyLoggedIn; | |
1384 | + //display user name | |
1385 | + $rootScope.userName=result.FirstName+" "+result.LastName; | |
1246 | 1386 | if (typeof result.FirstName != undefined || result.FirstName != "" || result.FirstName != null) { |
1247 | 1387 | //code for modesty setting |
1248 | 1388 | if (result.LicenseInfo != null) { |
... | ... | @@ -1298,10 +1438,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1298 | 1438 | $rootScope.userData = result; |
1299 | 1439 | $rootScope.userModules = result.Modules; |
1300 | 1440 | |
1301 | - if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") { | |
1302 | - localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); | |
1303 | - } | |
1304 | - | |
1441 | + localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); | |
1442 | + | |
1305 | 1443 | if (isCommingSoonModel == true) { |
1306 | 1444 | |
1307 | 1445 | ShowAssignedModulesPopup(result.Modules); |
... | ... | @@ -1320,6 +1458,14 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1320 | 1458 | else { |
1321 | 1459 | if (result.LicenseInfo != null ) { |
1322 | 1460 | |
1461 | + //only site instructor allowed to change modesty | |
1462 | + if(result.EditionId!=1 && result.EditionId!=2) | |
1463 | + { | |
1464 | + $("#modestyDiv").css("pointer-events", "none"); | |
1465 | + $("#modestyDiv").css("opacity", 0.5); | |
1466 | + $("#modestyDiv").find("*").prop('disabled', true); | |
1467 | + } | |
1468 | + | |
1323 | 1469 | // set license id |
1324 | 1470 | $scope.UpdateUserExportImageData(result.Id, 'LicenseId', result.LicenseId) |
1325 | 1471 | |
... | ... | @@ -1346,11 +1492,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1346 | 1492 | $rootScope.haveRoleAdmin = false; |
1347 | 1493 | |
1348 | 1494 | //2. |
1349 | - if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") { | |
1350 | - | |
1351 | - localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); | |
1352 | - } | |
1353 | - | |
1495 | + localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); | |
1354 | 1496 | |
1355 | 1497 | //5. |
1356 | 1498 | sessionStorage.setItem("loginSession", "true"); |
... | ... | @@ -1367,6 +1509,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1367 | 1509 | $('#dvTerms').html(result.TermsAndConditionsText); |
1368 | 1510 | } |
1369 | 1511 | $rootScope.isVisibleLogin = true; |
1512 | + $rootScope.LoginEnableUI(); | |
1370 | 1513 | $('#dvTermCondition').fadeIn(); |
1371 | 1514 | $rootScope.userData = result; |
1372 | 1515 | $rootScope.haveRoleAdmin = false; |
... | ... | @@ -1374,30 +1517,30 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1374 | 1517 | $location.path('/'); |
1375 | 1518 | } |
1376 | 1519 | } |
1520 | + $rootScope.LoginEnableUI(); | |
1521 | + // set user session time | |
1522 | + $rootScope.loadUserSession(); | |
1523 | + | |
1377 | 1524 | } |
1378 | 1525 | |
1379 | 1526 | |
1380 | 1527 | } |
1381 | 1528 | } |
1382 | 1529 | |
1383 | - | |
1384 | - | |
1385 | 1530 | }, |
1386 | 1531 | |
1387 | - function (error) { | |
1532 | + function (error) { | |
1388 | 1533 | |
1389 | - console.log(' Error in authentication = ' + error.statusText); | |
1390 | - // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); | |
1391 | - $rootScope.isVisibleLogin = true; | |
1392 | - $rootScope.errorMessage = error; | |
1393 | - $("#messageModal").modal('show'); | |
1534 | + console.log(' Error in authentication = ' + error.statusText); | |
1535 | + // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); | |
1536 | + $rootScope.LoginEnableUI(); | |
1537 | + $rootScope.isVisibleLogin = true; | |
1538 | + $rootScope.errorMessage = error; | |
1539 | + $("#messageModal").modal('show'); | |
1394 | 1540 | |
1395 | - } | |
1541 | + } | |
1396 | 1542 | ) |
1397 | 1543 | |
1398 | - } | |
1399 | - | |
1400 | - | |
1401 | 1544 | } |
1402 | 1545 | |
1403 | 1546 | $scope.saveRemeberMeDetails = function (result, userInfo) { |
... | ... | @@ -1469,8 +1612,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1469 | 1612 | $rootScope.userModules = userInfo.Modules; |
1470 | 1613 | // ShowAssignedModulesPopup(userInfo.Modules);; |
1471 | 1614 | // for reseller type user first need to update profile |
1472 | - // allow popup for instructor ,not for student. | |
1473 | - if (userInfo.UserTypeId == 7 && userInfo.EditionId == 1 && (userInfo.FirstName == "" || userInfo.EmailId == "" || userInfo.LastName == "")) { | |
1615 | + if (userInfo.UserTypeId == 7 && (userInfo.FirstName == "" || userInfo.EmailId == "" || userInfo.LastName == "")) { | |
1474 | 1616 | |
1475 | 1617 | $('#updateprofile').html(LoginMessageConstants.USER_UPDATE_PROFILE); |
1476 | 1618 | |
... | ... | @@ -1517,14 +1659,118 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1517 | 1659 | |
1518 | 1660 | } |
1519 | 1661 | |
1662 | + $rootScope.loadUserSession = function () { | |
1663 | + //update session config from API | |
1664 | + Idle.setIdle($rootScope.aiaIdleTime); | |
1665 | + Idle.setTimeout($rootScope.aiaIdleTimeOut); | |
1666 | + Keepalive.setInterval($rootScope.aiaPingInterval); | |
1667 | + | |
1668 | + Idle.watch();// start the session | |
1669 | + $rootScope.isSessionTimeout=false; | |
1670 | + $rootScope.isRedirectToAdmin=false; | |
1671 | + $rootScope.userStatus = { | |
1672 | + userId: null, | |
1673 | + tagName: null, | |
1674 | + loginStatus: null, | |
1675 | + isAlreadyLoggedIn:null | |
1676 | + } | |
1677 | + console.log('user session start'); | |
1678 | + $rootScope.CheckUserSession('insert',$rootScope.isAlreadyLoggedIn); | |
1679 | + | |
1680 | + $rootScope.$on('IdleStart', function() { | |
1681 | + // this event fire when idle time finish and time out start | |
1682 | + // config set in AIA.js -:IdleProvider.idle(1*30);; | |
1683 | + //alert('start'); | |
1684 | + }); | |
1685 | + $rootScope.$on('IdleEnd', function() { | |
1686 | + // this event fires by user activity during timeout period | |
1687 | + // it reset idle time and timeout | |
1688 | + // config set in AIA.js -:IdleProvider.interrupt('keydown wheel mousedown touchstart touchmove scroll'); | |
1689 | + // alert('end'); | |
1690 | + }); | |
1691 | + $rootScope.$on('IdleTimeout', function() { | |
1692 | + // this event fire when idle time finished and time out also finished | |
1693 | + // config set in AIA.js -:IdleProvider.timeout(15); | |
1694 | + $rootScope.isSessionTimeout=true; | |
1695 | + console.log('session is timeout'); | |
1696 | + $rootScope.CheckUserSession('logout',true); | |
1697 | + }); | |
1698 | + $rootScope.$on('Keepalive', function() { | |
1699 | + // it watch the session on perticular time interval during idle time period | |
1700 | + // config set in AIA.js -: KeepaliveProvider.interval(10); | |
1701 | + //we will use it to recieve request from databse if user logout from admin activity | |
1702 | + console.log('ping user session'); | |
1703 | + $rootScope.CheckUserSession('update',true); | |
1704 | + }); | |
1705 | + | |
1706 | + | |
1707 | + $window.onbeforeunload = function (e) { | |
1708 | + var confirmation = {}; | |
1709 | + // if($location.url()!= "/") { | |
1710 | + if ($rootScope.isSessionTimeout==false && $rootScope.isRedirectToAdmin==false) { | |
1711 | + var event = $rootScope.$broadcast('onBeforeUnload', confirmation); | |
1712 | + if (event.defaultPrevented) { | |
1713 | + return confirmation.message; | |
1714 | + } | |
1715 | + } | |
1716 | + // } | |
1717 | + | |
1718 | + }; | |
1719 | + } | |
1720 | + | |
1721 | + $rootScope.$on('onBeforeUnload', function (e, confirmation) { | |
1722 | + confirmation.message = "All data willl be lost."; | |
1723 | + e.preventDefault(); | |
1724 | + }); | |
1520 | 1725 | |
1521 | 1726 | $rootScope.LogoutUser = function () { |
1727 | + $rootScope.isSessionTimeout=true; | |
1728 | + localStorage.removeItem('loggedInUserDetails'); | |
1729 | + localStorage.clear(); | |
1730 | + $rootScope.CheckUserSession('logout',true); | |
1731 | + $timeout(function(){ | |
1732 | + document.location = '/'; | |
1733 | + $rootScope.isVisibleLogin = true; | |
1734 | + },50); | |
1735 | + | |
1736 | + } | |
1737 | + $rootScope.LogoutUserSession = function () { | |
1738 | + $rootScope.isSessionTimeout=true; | |
1522 | 1739 | localStorage.removeItem('loggedInUserDetails'); |
1523 | 1740 | localStorage.clear(); |
1524 | 1741 | document.location = '/'; |
1525 | 1742 | $rootScope.isVisibleLogin = true; |
1526 | 1743 | } |
1527 | 1744 | |
1745 | + $rootScope.CheckUserSession = function (tagName,isAlreadyLoggedIn) { | |
1746 | + //console.log('user login id: '+$rootScope.userData.Id); | |
1747 | + //console.log('user login activity tag: '+tagName); | |
1748 | + if($rootScope.userData==undefined) return; | |
1749 | + //incase site user login userid is 0 so then using license id | |
1750 | + $rootScope.userStatus.userId=$rootScope.userData.Id==0?$rootScope.userData.LicenseId:$rootScope.userData.Id; | |
1751 | + $rootScope.userStatus.tagName=tagName; | |
1752 | + $rootScope.userStatus.isAlreadyLoggedIn=isAlreadyLoggedIn; | |
1753 | + $rootScope.isAlreadyLoggedIn=true; | |
1754 | + AuthenticationService.ManageUserLoginStatus($rootScope.userStatus) | |
1755 | + .then( | |
1756 | + function (loginStatus) { | |
1757 | + if(loginStatus!=null) | |
1758 | + { | |
1759 | + if(loginStatus=='False') | |
1760 | + { | |
1761 | + $rootScope.LogoutUserSession(); | |
1762 | + } | |
1763 | + } | |
1764 | + | |
1765 | + }), | |
1766 | + function (error) { | |
1767 | + console.log(' Error in user login status = ' + error.statusText); | |
1768 | + $rootScope.errorMessage = error; | |
1769 | + $("#messageModal").modal('show'); | |
1770 | + } | |
1771 | + | |
1772 | + } | |
1773 | + | |
1528 | 1774 | function AuthenticateAlreadyLoggedInUser() { |
1529 | 1775 | |
1530 | 1776 | isCommingSoonModel = $rootScope.getLocalStorageValue('isCommingSoonModel'); |
... | ... | @@ -1538,7 +1784,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1538 | 1784 | userInfo["password"] = userInfo.Password; |
1539 | 1785 | |
1540 | 1786 | |
1541 | - $rootScope.AuthenticateUser(userInfo); | |
1787 | + $rootScope.AuthenticateUser(userInfo,true); | |
1542 | 1788 | |
1543 | 1789 | if ($rootScope.refreshcheck == null) { |
1544 | 1790 | |
... | ... | @@ -1919,25 +2165,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1919 | 2165 | }); |
1920 | 2166 | |
1921 | 2167 | $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); |
1922 | - $("#drawTextBGColorpicker .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#ffffff" }); | |
1923 | - | |
1924 | - $window.onbeforeunload = function (e) { | |
1925 | - var confirmation = {}; | |
1926 | - if($location.url()!= "/") { | |
1927 | - var event = $rootScope.$broadcast('onBeforeUnload', confirmation); | |
1928 | - if (event.defaultPrevented) { | |
1929 | - return confirmation.message; | |
1930 | - } | |
1931 | - } | |
1932 | - | |
1933 | - }; | |
2168 | + $("#drawTextBGColorpicker .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#ffffff" }); | |
1934 | 2169 | }); |
1935 | 2170 | |
1936 | - $scope.$on('onBeforeUnload', function (e, confirmation) { | |
1937 | - confirmation.message = "All data willl be lost."; | |
1938 | - e.preventDefault(); | |
1939 | - }); | |
1940 | - | |
1941 | 2171 | $rootScope.$on("$locationChangeSuccess", function () { |
1942 | 2172 | |
1943 | 2173 | $rootScope.HightLightModuleSelection = function (moduleUrl) { |
... | ... | @@ -7314,6 +7544,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
7314 | 7544 | $rootScope.reDirectURLToAdmin = function () { |
7315 | 7545 | $("#profileUpdateModal").modal('hide'); |
7316 | 7546 | $timeout(function () { |
7547 | + $rootScope.isRedirectToAdmin=true; | |
7317 | 7548 | window.location.href = "Admin"; |
7318 | 7549 | }, 300) |
7319 | 7550 | |
... | ... | @@ -7450,6 +7681,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
7450 | 7681 | |
7451 | 7682 | $rootScope.StoreModuleName = function (moduleName) { |
7452 | 7683 | |
7684 | + // clear UI of external module like encyclopedia,aod | |
7685 | + if ($('#siteloader').html() != undefined) { | |
7686 | + $('#siteloader').remove(); | |
7687 | + } | |
7453 | 7688 | var userid = $rootScope.userData.Id; |
7454 | 7689 | $scope.UpdateUserExportImageData(userid,'ModuleName',moduleName); |
7455 | 7690 | |
... | ... | @@ -7603,7 +7838,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
7603 | 7838 | }; |
7604 | 7839 | |
7605 | 7840 | }] |
7606 | -); | |
7841 | +) | |
7607 | 7842 | function printImagePreview(event) { |
7608 | 7843 | var scope = angular.element(document.querySelector('[ng-controller="HomeController"]')).scope(); |
7609 | 7844 | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/LinkController.js
1 | 1 | 'use strict'; |
2 | 2 | |
3 | -AIA.controller("LinkController", ["$scope", "$rootScope", "$log", "$location", "pages", "$routeParams", "$window", | |
4 | -function ($scope, $rootScope, log, $location, pages, $routeParams, $window) { | |
3 | +AIA.controller("LinkController", ["$scope", "$rootScope", "$log", "$location", "pages", "$routeParams", "$window","$interval", | |
4 | +function ($scope, $rootScope, log, $location, pages, $routeParams, $window,$interval) { | |
5 | 5 | |
6 | 6 | //$rootScope.currentActiveModuleTitle = Modules[10].Name; |
7 | 7 | //$rootScope.currentActiveModuleTitle = $routeParams.modname; |
... | ... | @@ -59,11 +59,43 @@ function ($scope, $rootScope, log, $location, pages, $routeParams, $window) { |
59 | 59 | } |
60 | 60 | |
61 | 61 | } |
62 | + $scope.refreshIdleTime(); | |
62 | 63 | } |
63 | 64 | } |
64 | 65 | } |
65 | 66 | }); |
66 | 67 | |
68 | + $scope.refreshIdleTime = function () { | |
69 | + var timeintval = null; | |
70 | + timeintval = $interval(PointerEventEnableDisable, 5000); | |
71 | + | |
72 | + function PointerEventEnableDisable() { | |
73 | + var pointevents = $("#externalLink").css('pointer-events'); | |
74 | + if (pointevents=='auto') { | |
75 | + $scope.stopLinkRefresh(timeintval); | |
76 | + timeintval = $interval(PointerEventEnableDisable, 500); | |
77 | + $("#externalLink").css('pointer-events', 'none'); | |
78 | + } | |
79 | + else if(pointevents=='none') | |
80 | + { | |
81 | + $("#externalLink").css('pointer-events', 'auto'); | |
82 | + $scope.stopLinkRefresh(timeintval); | |
83 | + timeintval = $interval(PointerEventEnableDisable, 5000); | |
84 | + } | |
85 | + else | |
86 | + { | |
87 | + //auto clode interval when panel close | |
88 | + $scope.stopLinkRefresh(timeintval); | |
89 | + } | |
90 | + } | |
91 | + | |
92 | + $scope.stopLinkRefresh = function (timeintval) { | |
93 | + if (angular.isDefined(timeintval)) { | |
94 | + $interval.cancel(timeintval); | |
95 | + timeintval = undefined; | |
96 | + } | |
97 | + }; | |
98 | + } | |
67 | 99 | $scope.showTabButton = false; |
68 | 100 | $scope.IsVisible = function () { |
69 | 101 | $scope.scroll(); | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
1 | 1 | 'use strict'; |
2 | 2 | |
3 | -var AIA = angular.module('AIA', ['ngSanitize', 'ngRoute', 'ngStorage', 'ui.bootstrap']); | |
3 | +var AIA = angular.module('AIA', ['ngSanitize', 'ngRoute', 'ngStorage', 'ui.bootstrap','ngIdle']); | |
4 | 4 | |
5 | 5 | |
6 | 6 | |
... | ... | @@ -403,7 +403,7 @@ AIA.constant("LoginConstants", { |
403 | 403 | }); |
404 | 404 | |
405 | 405 | AIA.constant("LoginMessageConstants", { |
406 | - "USER_UPDATE_PROFILE":"Please update your profile first", | |
406 | + "USER_UPDATE_PROFILE":"Please update your profile first.", | |
407 | 407 | "USER_OR_PASSWORD_INCORRECT": "UserId or Password is incorrect.", |
408 | 408 | "RESET_PASSWORD": "Please check you email and reset your password.", |
409 | 409 | "USERID_SENT_IN_EMAIL": "We have sent you userId in email.", |
... | ... | @@ -571,4 +571,12 @@ AIA.config(function ($routeProvider, pages, $locationProvider) { |
571 | 571 | |
572 | 572 | } |
573 | 573 | } |
574 | -}); | |
575 | 574 | \ No newline at end of file |
575 | +}); | |
576 | +AIA.config(function(IdleProvider, KeepaliveProvider) { | |
577 | + | |
578 | + //default configuration | |
579 | + IdleProvider.idle(20*60); // 20 minutes idle | |
580 | + IdleProvider.timeout(30); // after 30 seconds idle, time the user out | |
581 | + KeepaliveProvider.interval(10); // 10 seconds keep-alive ping | |
582 | + IdleProvider.interrupt('keydown mousemove wheel mousedown touchstart touchmove scroll'); | |
583 | +}) | |
576 | 584 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | console.log('error') |
16 | 16 | deferred.reject(data); |
17 | 17 | $rootScope.isVisibleLogin = true; |
18 | + $rootScope.LoginEnableUI(); | |
18 | 19 | $rootScope.errorMessage = data; |
19 | 20 | $("#messageModal").modal('show'); |
20 | 21 | |
... | ... | @@ -55,6 +56,29 @@ |
55 | 56 | deferred.resolve(data); |
56 | 57 | }).error(function (data, status, headers, config) { |
57 | 58 | console.log('error') |
59 | + $rootScope.isVisibleLogin = true; | |
60 | + $rootScope.LoginEnableUI(); | |
61 | + deferred.reject(data); | |
62 | + $rootScope.errorMessage = data; | |
63 | + $("#messageModal").modal('show'); | |
64 | + | |
65 | + }); | |
66 | + return deferred.promise; | |
67 | + }, | |
68 | + | |
69 | + ManageUserLoginStatus: function (logindata) { | |
70 | + var deferred = $q.defer();//userId tagName | |
71 | + | |
72 | + $http.post('/API/api/ManageUserLoginStatus', JSON.stringify(logindata), { | |
73 | + headers: { | |
74 | + 'Content-Type': 'application/json' | |
75 | + } | |
76 | + }) | |
77 | + .success(function (data, status, headers, config) { | |
78 | + console.log('success') | |
79 | + deferred.resolve(data); | |
80 | + }).error(function (data, status, headers, config) { | |
81 | + console.log('error') | |
58 | 82 | deferred.reject(data); |
59 | 83 | $rootScope.errorMessage = data; |
60 | 84 | $("#messageModal").modal('show'); |
... | ... | @@ -120,6 +144,7 @@ |
120 | 144 | console.log('error') |
121 | 145 | deferred.reject(data); |
122 | 146 | $rootScope.isVisibleLogin = true; |
147 | + $rootScope.LoginEnableUI(); | |
123 | 148 | $rootScope.errorMessage = data; |
124 | 149 | $("#messageModal").modal('show'); |
125 | 150 | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html
... | ... | @@ -48,7 +48,7 @@ |
48 | 48 | <li class="navbarItem"><a ng-click="reDirectURLToAdmin()" ng-show="haveRoleAdmin" style="cursor: pointer;">Admin</a></li> |
49 | 49 | </ul> |
50 | 50 | <ul class="nav navbar-nav navbar-right"> |
51 | - <li class="visible-xs"><a href="" ng-click="LogoutUser()">Logout</a></li> | |
51 | + <li class="navbarItem" style="pointer-events:none ;"><a href="#">{{userName}}</a></li> | |
52 | 52 | <li class="hidden-xs marginR5 logOut" data-toggle="tooltip" data-placement="top" title="Logout"><a href="" ng-click="LogoutUser()"><i class="fa fa-power-off"></i></a></li> |
53 | 53 | </ul> |
54 | 54 | <div id="imaginary_container" style="visibility:hidden"> | ... | ... |
400-SOURCECODE/AIAHTML5.Web/index.aspx
... | ... | @@ -221,6 +221,9 @@ |
221 | 221 | <div class="form-group"> |
222 | 222 | <button class="btn btn-primary pull-right" ng-click="AuthenticateUser(userInfo)">Log In</button> |
223 | 223 | </div> |
224 | + <div id="spinnerLogin" class="spinner" ng-show="isLoginLoading" style="visibility:hidden"> | |
225 | + <img id="img-spinner" src="content/images/common/loading.gif" alt="Loading" /> | |
226 | + </div> | |
224 | 227 | </form> |
225 | 228 | </div> |
226 | 229 | </div> |
... | ... | @@ -1515,6 +1518,7 @@ |
1515 | 1518 | <script src="libs/angular/1.4.9/angular-sanitize.min.js"></script> |
1516 | 1519 | <script src="themes/default/scripts/bootstrap/3.3.5/ui-bootstrap-tpls-0.3.0.min.js"></script> |
1517 | 1520 | <script src="libs/angular/1.4.9/ngStorage.js"></script> |
1521 | + <script src="libs/angular/1.4.9/angular-idle.min.js"></script> | |
1518 | 1522 | <script src="content/js/custom/custom.js"></script> |
1519 | 1523 | <!--Annotation Toolbar : jcanvas Library--> |
1520 | 1524 | ... | ... |
400-SOURCECODE/AIAHTML5.Web/libs/angular/1.4.9/angular-idle.min.js
0 → 100644
1 | +/*** Directives and services for responding to idle users in AngularJS | |
2 | +* @author Mike Grabski <me@mikegrabski.com> | |
3 | +* @version v1.3.2 | |
4 | +* @link https://github.com/HackedByChinese/ng-idle.git | |
5 | +* @license MIT | |
6 | +*/ | |
7 | + | |
8 | +!function(a,b,c){"use strict";b.module("ngIdle",["ngIdle.keepalive","ngIdle.idle","ngIdle.countdown","ngIdle.title","ngIdle.localStorage"]),b.module("ngIdle.keepalive",[]).provider("Keepalive",function(){var a={http:null,interval:600};this.http=function(c){if(!c)throw new Error("Argument must be a string containing a URL, or an object containing the HTTP request configuration.");b.isString(c)&&(c={url:c,method:"GET"}),c.cache=!1,a.http=c};var c=this.interval=function(b){if(b=parseInt(b),isNaN(b)||0>=b)throw new Error("Interval must be expressed in seconds and be greater than 0.");a.interval=b};this.$get=["$rootScope","$log","$interval","$http",function(d,e,f,g){function h(a){d.$broadcast("KeepaliveResponse",a.data,a.status)}function i(){d.$broadcast("Keepalive"),b.isObject(a.http)&&g(a.http).then(h)["catch"](h)}var j={ping:null};return{_options:function(){return a},setInterval:c,start:function(){return f.cancel(j.ping),j.ping=f(i,1e3*a.interval),j.ping},stop:function(){f.cancel(j.ping)},ping:function(){i()}}}]}),b.module("ngIdle.idle",["ngIdle.keepalive","ngIdle.localStorage"]).provider("Idle",function(){var a={idle:1200,timeout:30,autoResume:"idle",interrupt:"mousemove keydown DOMMouseScroll mousewheel mousedown touchstart touchmove scroll",windowInterrupt:null,keepalive:!0},c=this.timeout=function(c){if(c===!1)a.timeout=0;else{if(!(b.isNumber(c)&&c>=0))throw new Error("Timeout must be zero or false to disable the feature, or a positive integer (in seconds) to enable it.");a.timeout=c}};this.interrupt=function(b){a.interrupt=b},this.windowInterrupt=function(b){a.windowInterrupt=b};var d=this.idle=function(b){if(0>=b)throw new Error("Idle must be a value in seconds, greater than 0.");a.idle=b};this.autoResume=function(b){b===!0?a.autoResume="idle":b===!1?a.autoResume="off":a.autoResume=b},this.keepalive=function(b){a.keepalive=b===!0},this.$get=["$interval","$log","$rootScope","$document","Keepalive","IdleLocalStorage","$window",function(e,f,g,h,i,j,k){function l(){a.keepalive&&(u.running&&i.ping(),i.start())}function m(){a.keepalive&&i.stop()}function n(){u.idling=!u.idling;var b=u.idling?"IdleStart":"IdleEnd";u.idling?(g.$broadcast(b),m(),a.timeout&&(u.countdown=a.timeout,o(),u.timeout=e(o,1e3,a.timeout,!1))):(l(),g.$broadcast(b)),e.cancel(u.idle)}function o(){if(u.idling){if(u.countdown<=0)return void q();g.$broadcast("IdleWarn",u.countdown),u.countdown--}}function p(a){g.$broadcast("IdleInterrupt",a)}function q(){m(),e.cancel(u.idle),e.cancel(u.timeout),u.idling=!0,u.running=!1,u.countdown=0,g.$broadcast("IdleTimeout")}function r(a,b,c){var d=a.running();a.unwatch(),b(c),d&&a.watch()}function s(){var a=j.get("expiry");return a&&a.time?new Date(a.time):null}function t(a){a?j.set("expiry",{id:v,time:a}):j.remove("expiry")}var u={idle:null,timeout:null,idling:!1,running:!1,countdown:null},v=(new Date).getTime(),w={_options:function(){return a},_getNow:function(){return new Date},getIdle:function(){return a.idle},getTimeout:function(){return a.timeout},setIdle:function(a){r(this,d,a)},setTimeout:function(a){r(this,c,a)},isExpired:function(){var a=s();return null!==a&&a<=this._getNow()},running:function(){return u.running},idling:function(){return u.idling},watch:function(b){e.cancel(u.idle),e.cancel(u.timeout);var c=a.timeout?a.timeout:0;b||t(new Date((new Date).getTime()+1e3*(a.idle+c))),u.idling?n():u.running||l(),u.running=!0,u.idle=e(n,1e3*a.idle,0,!1)},unwatch:function(){e.cancel(u.idle),e.cancel(u.timeout),u.idling=!1,u.running=!1,t(null),m()},interrupt:function(b){if(u.running){if(a.timeout&&this.isExpired())return void q();p(b),(b||"idle"===a.autoResume||"notIdle"===a.autoResume&&!u.idling)&&this.watch(b)}}},x={clientX:null,clientY:null,swap:function(a){var b={clientX:this.clientX,clientY:this.clientY};return this.clientX=a.clientX,this.clientY=a.clientY,b},hasMoved:function(a){var b=this.swap(a);return null===this.clientX||a.movementX||a.movementY?!0:b.clientX!=a.clientX||b.clientY!=a.clientY?!0:!1}};if(h.find("html").on(a.interrupt,function(a){"mousemove"===a.type&&a.originalEvent&&0===a.originalEvent.movementX&&0===a.originalEvent.movementY||("mousemove"!==a.type||x.hasMoved(a))&&w.interrupt()}),a.windowInterrupt)for(var y=a.windowInterrupt.split(" "),z=function(){w.interrupt()},A=0;A<y.length;A++)k.addEventListener?(k.addEventListener(y[A],z,!1),g.$on("$destroy",function(){k.removeEventListener(y[A],z,!1)})):(k.attachEvent(y[A],z),g.$on("$destroy",function(){k.detachEvent(y[A],z)}));var B=function(a){if("ngIdle.expiry"===a.key&&a.newValue&&a.newValue!==a.oldValue){var c=b.fromJson(a.newValue);if(c.id===v)return;w.interrupt(!0)}};return k.addEventListener?(k.addEventListener("storage",B,!1),g.$on("$destroy",function(){k.removeEventListener("storage",B,!1)})):k.attachEvent&&(k.attachEvent("onstorage",B),g.$on("$destroy",function(){k.detachEvent("onstorage",B)})),w}]}),b.module("ngIdle.countdown",["ngIdle.idle"]).directive("idleCountdown",["Idle",function(a){return{restrict:"A",scope:{value:"=idleCountdown"},link:function(b){b.value=a.getTimeout(),b.$on("IdleWarn",function(a,c){b.$evalAsync(function(){b.value=c})}),b.$on("IdleTimeout",function(){b.$evalAsync(function(){b.value=0})})}}}]),b.module("ngIdle.title",[]).provider("Title",function(){function a(a,b,c){return new Array(b-String(a).length+1).join(c||"0")+a}var c={enabled:!0},d=this.enabled=function(a){c.enabled=a===!0};this.$get=["$document","$interpolate",function(e,f){var g={original:null,idle:"{{minutes}}:{{seconds}} until your session times out!",timedout:"Your session has expired."};return{setEnabled:d,isEnabled:function(){return c.enabled},original:function(a){return b.isUndefined(a)?g.original:void(g.original=a)},store:function(a){(a||!g.original)&&(g.original=this.value())},value:function(a){return b.isUndefined(a)?e[0].title:void(e[0].title=a)},idleMessage:function(a){return b.isUndefined(a)?g.idle:void(g.idle=a)},timedOutMessage:function(a){return b.isUndefined(a)?g.timedout:void(g.timedout=a)},setAsIdle:function(b){this.store();var c={totalSeconds:b};c.minutes=Math.floor(b/60),c.seconds=a(b-60*c.minutes,2),this.value(f(this.idleMessage())(c))},setAsTimedOut:function(){this.store(),this.value(this.timedOutMessage())},restore:function(){this.original()&&this.value(this.original())}}}]}).directive("title",["Title",function(a){return{restrict:"E",link:function(b,c,d){a.isEnabled()&&!d.idleDisabled&&(a.store(!0),b.$on("IdleStart",function(){a.original(c[0].innerText)}),b.$on("IdleWarn",function(b,c){a.setAsIdle(c)}),b.$on("IdleEnd",function(){a.restore()}),b.$on("IdleTimeout",function(){a.setAsTimedOut()}))}}}]),b.module("ngIdle.localStorage",[]).service("IdleStorageAccessor",["$window",function(a){return{get:function(){return a.localStorage}}}]).service("IdleLocalStorage",["IdleStorageAccessor",function(a){function d(){var a={};this.setItem=function(b,c){a[b]=c},this.getItem=function(b){return"undefined"!=typeof a[b]?a[b]:null},this.removeItem=function(b){a[b]=c}}function e(){try{var b=a.get();return b.setItem("ngIdleStorage",""),b.removeItem("ngIdleStorage"),b}catch(c){return new d}}var f=e();return{set:function(a,c){f.setItem("ngIdle."+a,b.toJson(c))},get:function(a){return b.fromJson(f.getItem("ngIdle."+a))},remove:function(a){f.removeItem("ngIdle."+a)},_wrapped:function(){return f}}}])}(window,window.angular); | |
9 | +//# sourceMappingURL=angular-idle.map | |
0 | 10 | \ No newline at end of file | ... | ... |
400-SOURCECODE/Admin/package-lock.json
... | ... | @@ -276,6 +276,16 @@ |
276 | 276 | "tsickle": "^0.21.0" |
277 | 277 | } |
278 | 278 | }, |
279 | + "@ng-idle/core": { | |
280 | + "version": "2.0.0-beta.9", | |
281 | + "resolved": "https://registry.npmjs.org/@ng-idle/core/-/core-2.0.0-beta.9.tgz", | |
282 | + "integrity": "sha1-+ZsIF0kc2lTAh9bNhs7SMQ//5qQ=" | |
283 | + }, | |
284 | + "@ng-idle/keepalive": { | |
285 | + "version": "2.0.0-beta.9", | |
286 | + "resolved": "https://registry.npmjs.org/@ng-idle/keepalive/-/keepalive-2.0.0-beta.9.tgz", | |
287 | + "integrity": "sha1-f3HkrIcG042pZl04JWDPv72IEh8=" | |
288 | + }, | |
279 | 289 | "@ng-select/ng-select": { |
280 | 290 | "version": "2.20.5", |
281 | 291 | "resolved": "https://registry.npmjs.org/@ng-select/ng-select/-/ng-select-2.20.5.tgz", |
... | ... | @@ -485,6 +495,14 @@ |
485 | 495 | "resolved": "https://registry.npmjs.org/angular2-json2csv/-/angular2-json2csv-1.1.2.tgz", |
486 | 496 | "integrity": "sha1-ETRWynbEyZiLU44jAUHCwT4DxpI=" |
487 | 497 | }, |
498 | + "angular2-moment": { | |
499 | + "version": "1.9.0", | |
500 | + "resolved": "https://registry.npmjs.org/angular2-moment/-/angular2-moment-1.9.0.tgz", | |
501 | + "integrity": "sha512-ybPjYizpKVWAI2Z4AqxAS6s3FMkF3+zRpfvxX1wIdSJUFjl83XxQ5f2yn7retX68NSYZZ/JTK9KGnvOzZfrIZw==", | |
502 | + "requires": { | |
503 | + "moment": "^2.19.3" | |
504 | + } | |
505 | + }, | |
488 | 506 | "angular4-slimscroll": { |
489 | 507 | "version": "1.0.5", |
490 | 508 | "resolved": "https://registry.npmjs.org/angular4-slimscroll/-/angular4-slimscroll-1.0.5.tgz", |
... | ... | @@ -7001,6 +7019,11 @@ |
7001 | 7019 | "minimist": "0.0.8" |
7002 | 7020 | } |
7003 | 7021 | }, |
7022 | + "moment": { | |
7023 | + "version": "2.28.0", | |
7024 | + "resolved": "https://registry.npmjs.org/moment/-/moment-2.28.0.tgz", | |
7025 | + "integrity": "sha512-Z5KOjYmnHyd/ukynmFd/WwyXHd7L4J9vTI/nn5Ap9AVUgaAE15VvQ9MOGmJJygEUklupqIrFnor/tjTwRU+tQw==" | |
7026 | + }, | |
7004 | 7027 | "move-concurrently": { |
7005 | 7028 | "version": "1.0.1", |
7006 | 7029 | "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", | ... | ... |
400-SOURCECODE/Admin/package.json
... | ... | @@ -23,9 +23,12 @@ |
23 | 23 | "@angular/platform-browser": "^4.2.4", |
24 | 24 | "@angular/platform-browser-dynamic": "^4.2.4", |
25 | 25 | "@angular/router": "^4.2.4", |
26 | + "@ng-idle/core": "^2.0.0-beta.9", | |
27 | + "@ng-idle/keepalive": "^2.0.0-beta.9", | |
26 | 28 | "@ng-select/ng-select": "^2.1.2", |
27 | 29 | "@types/node": "^6.0.102", |
28 | 30 | "angular2-json2csv": "^1.1.2", |
31 | + "angular2-moment": "^1.9.0", | |
29 | 32 | "angular4-slimscroll": "^1.0.5", |
30 | 33 | "classlist.js": "1.1.20150312", |
31 | 34 | "core-js": "^2.5.3", | ... | ... |
400-SOURCECODE/Admin/src/app/app.component.html
... | ... | @@ -106,7 +106,7 @@ |
106 | 106 | <div class="wel-brog"> |
107 | 107 | <div class="btn-group pull-right mob1"> |
108 | 108 | <ul class="nav navbar-nav navbar-right hidden-sm"> |
109 | - <li class="marginR5" data-toggle="tooltip" data-placement="top" title="Logout"><a (click)="logout()"><i class="fa fa-power-off"></i></a></li> | |
109 | + <li class="marginR5" data-toggle="tooltip" data-placement="top" title="Logout"><a (click)="logout()"><i class="fa fa-power-off" style="cursor:pointer"></i></a></li> | |
110 | 110 | </ul> |
111 | 111 | </div> |
112 | 112 | <div class="btn-group pull-right hidden-sm mar-top17 mob2"> | ... | ... |
400-SOURCECODE/Admin/src/app/app.component.ts
... | ... | @@ -8,6 +8,12 @@ import { UserManageRightsModel } from './components/userentity/datamodel'; |
8 | 8 | //import { MyAuthService } from './shared/my-auth.service'; |
9 | 9 | import { GlobalService } from './shared/global'; |
10 | 10 | import { Router, NavigationEnd } from '@angular/router'; |
11 | +import { LoadingService } from './shared/loading.service'; | |
12 | +import {Idle, DEFAULT_INTERRUPTSOURCES} from '@ng-idle/core'; | |
13 | +import {Keepalive} from '@ng-idle/keepalive'; | |
14 | +import { Title } from '@angular/platform-browser'; | |
15 | +import { ConfirmService } from './shared/confirm/confirm.service'; | |
16 | +import { timeout } from 'rxjs/operator/timeout'; | |
11 | 17 | |
12 | 18 | //import { HttpClient } from '@angular/common/http'; |
13 | 19 | //import { HttpErrorResponse } from '@angular/common/http'; |
... | ... | @@ -28,8 +34,57 @@ export class AppComponent implements OnInit { |
28 | 34 | public UpdateProfileVisible: boolean; |
29 | 35 | public UserManageRightsList: Array<UserManageRightsModel>; |
30 | 36 | |
31 | - constructor(private userservice: UserService, public global: GlobalService, private router: Router, | |
32 | - ) { } | |
37 | + constructor(private idle: Idle, private keepalive: Keepalive,private titleService: Title,private _confirmService: ConfirmService,private userservice: UserService,private _loadingService: LoadingService, public global: GlobalService, private router: Router,) { | |
38 | + const projectTitle= this.titleService.getTitle(); | |
39 | + | |
40 | + console.log("idleTime: "+this.global.aiaIdleTime+" aiaIdleTimeOut: "+this.global.aiaIdleTimeOut+" Interval: "+this.global.aiaPingInterval); | |
41 | + // sets an idle timeout of 20 minutes. | |
42 | + this.idle.setIdle(this.global.aiaIdleTime); | |
43 | + | |
44 | + // sets a timeout period of 30 seconds. after 30 seconds of inactivity, the user will be considered timed out. | |
45 | + this.idle.setTimeout(this.global.aiaIdleTimeOut); | |
46 | + | |
47 | + // sets the ping interval to 10 seconds | |
48 | + this.keepalive.interval(this.global.aiaPingInterval); | |
49 | + | |
50 | + // sets the default interrupts, in this case, things like clicks, scrolls,mousemove touches to the document | |
51 | + this.idle.setInterrupts(DEFAULT_INTERRUPTSOURCES); | |
52 | + | |
53 | + this.idle.onInterrupt.subscribe(() => { | |
54 | + this.titleService.setTitle(projectTitle); | |
55 | + }) | |
56 | + | |
57 | + this.idle.onTimeout.subscribe(() => { | |
58 | + //console.log("Timed out!"); | |
59 | + this.titleService.setTitle('Your session has expired!'); | |
60 | + this._loadingService.ShowLoading("global-loading"); | |
61 | + this.loginManageStatus('logout'); | |
62 | + }); | |
63 | + | |
64 | + this.idle.onTimeoutWarning.subscribe((countdown) => { | |
65 | + // console.log("You will time out in "+countdown); | |
66 | + var minute=Math.floor(countdown/60); | |
67 | + var remaining = minute+':'+(("00" + (countdown - minute * 60)).slice(-2) ); | |
68 | + this.titleService.setTitle(remaining+' until your session times out!'); | |
69 | + }); | |
70 | + | |
71 | + this.keepalive.onPing.subscribe(() =>{ | |
72 | + // this.lastPing = new Date(); | |
73 | + // console.log("last ping: "+this.lastPing); | |
74 | + this.loginManageStatus('update'); | |
75 | + }); | |
76 | + | |
77 | + // this.idle.onIdleEnd.subscribe(() => { | |
78 | + // console.log("No longer idle. "); | |
79 | + // }); | |
80 | + // this.idle.onIdleStart.subscribe(() =>{ | |
81 | + // console.log("You\'ve gone idle!"); | |
82 | + // }); | |
83 | + | |
84 | + this.idle.watch(); | |
85 | + | |
86 | + } | |
87 | + | |
33 | 88 | ngOnInit(): void { |
34 | 89 | this.menustaus = "True"; |
35 | 90 | this.global.getJSON().subscribe(data => { |
... | ... | @@ -69,17 +124,50 @@ export class AppComponent implements OnInit { |
69 | 124 | } |
70 | 125 | } |
71 | 126 | }, error => console.log(error)); |
72 | - | |
73 | - | |
74 | 127 | } |
128 | + | |
75 | 129 | logout() { |
76 | - localStorage.removeItem('loggedInUserDetails'); | |
77 | - //window.location.href = this.global.LiveURL; | |
78 | - window.location.href = window.location.origin; | |
130 | + this._loadingService.ShowLoading("global-loading"); | |
131 | + this.loginManageStatus('logout'); | |
79 | 132 | } |
133 | + loginManageStatus(tagname:string) { | |
134 | + this.userservice.ManageUserLoginStatus({ | |
135 | + userId: this.global.UserId, | |
136 | + tagName: tagname, | |
137 | + isAlreadyLoggedIn:true | |
138 | + }).subscribe(status => { | |
139 | + console.log(status); | |
140 | + if(status=='False') | |
141 | + { | |
142 | + if(tagname=='logout') | |
143 | + { | |
144 | + this._loadingService.HideLoading("global-loading"); | |
145 | + } | |
146 | + | |
147 | + if(window.location.hostname!="localhost") | |
148 | + { | |
149 | + localStorage.removeItem('loggedInUserDetails'); | |
150 | + window.location.href = window.location.origin; | |
151 | + | |
152 | + } | |
153 | + | |
154 | + } | |
155 | + | |
156 | + },error =>{ | |
157 | + console.log(error); | |
158 | + this.idle.stop(); | |
159 | + this._confirmService.activate(error, "alertMsg"); | |
160 | + this._loadingService.HideLoading("global-loading"); | |
161 | + setTimeout(function(){ | |
162 | + window.location.href = window.location.origin; | |
163 | + },5000); | |
164 | + }) | |
165 | + } | |
166 | + | |
80 | 167 | Product() { |
81 | 168 | //window.location.href = this.global.LiveURL; |
82 | 169 | window.location.href = window.location.origin; |
83 | 170 | //this.router.navigate([this.global.LiveURL]); |
84 | 171 | } |
172 | + | |
85 | 173 | } | ... | ... |
400-SOURCECODE/Admin/src/app/app.module.ts
1 | 1 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; |
2 | -import { BrowserModule } from '@angular/platform-browser'; | |
2 | +import { BrowserModule,Title } from '@angular/platform-browser'; | |
3 | 3 | import { NgModule } from '@angular/core'; |
4 | 4 | import { RouterModule, Routes } from '@angular/router'; |
5 | 5 | import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; |
... | ... | @@ -8,6 +8,10 @@ import { HttpModule } from '@angular/http'; |
8 | 8 | //import { Ng2SmartTableModule } from 'ng2-smart-table'; |
9 | 9 | import { Ng2Bs3ModalModule } from 'ng2-bs3-modal/ng2-bs3-modal'; |
10 | 10 | import { CsvService } from "angular2-json2csv"; |
11 | + | |
12 | +import { NgIdleKeepaliveModule } from '@ng-idle/keepalive'; | |
13 | +import { MomentModule } from 'angular2-moment'; | |
14 | + | |
11 | 15 | import { BsDatepickerModule, ModalModule } from 'ngx-bootstrap'; |
12 | 16 | import { BsModalService } from 'ngx-bootstrap/modal'; |
13 | 17 | import { BsDropdownModule } from 'ngx-bootstrap'; |
... | ... | @@ -83,11 +87,11 @@ import { MyFilterPipe } from './shared/my-filter.pipe'; |
83 | 87 | ], |
84 | 88 | imports: [ |
85 | 89 | BrowserModule, AppRoutingModule, HttpClientModule, FormsModule, ReactiveFormsModule, HttpModule, Ng2Bs3ModalModule, |
86 | - BsDatepickerModule.forRoot(), ModalModule.forRoot(), BsDropdownModule.forRoot(), Ng2OrderModule | |
90 | + BsDatepickerModule.forRoot(), ModalModule.forRoot(), BsDropdownModule.forRoot(), Ng2OrderModule,MomentModule,NgIdleKeepaliveModule.forRoot() | |
87 | 91 | //ModalModule.forRoot() |
88 | 92 | // , AngularFireModule.initializeApp(firebaseConfig), |
89 | 93 | ], |
90 | - providers: [GlobalService, ConfirmService, BsModalService, LoadingService, CsvService, | |
94 | + providers: [GlobalService, ConfirmService, BsModalService, LoadingService, CsvService,Title, | |
91 | 95 | // MyAuthService, AngularFireAuth, FirebaseApp, AngularFireModule, |
92 | 96 | |
93 | 97 | //AuthService, | ... | ... |
400-SOURCECODE/Admin/src/app/components/UserEntity/updateuserprofile.component.ts
... | ... | @@ -91,7 +91,6 @@ export class UpdateUserProfile implements OnInit { |
91 | 91 | |
92 | 92 | this.userservice.GetUserById() |
93 | 93 | .subscribe(x => { console.log(x); this.bindUsers(x) }, error => this.error = <any>error); |
94 | - this._loadingService.HideLoading("global-loading"); | |
95 | 94 | } |
96 | 95 | UpdateUserProfile() { |
97 | 96 | this.alerts = ''; |
... | ... | @@ -114,7 +113,7 @@ export class UpdateUserProfile implements OnInit { |
114 | 113 | |
115 | 114 | if (this.userFrm.valid && this.alerts == '') { |
116 | 115 | var obj = this.userFrm.value; |
117 | - | |
116 | + this._loadingService.ShowLoading("global-loading"); | |
118 | 117 | return this.userservice.UpdateUserProfileById(obj) |
119 | 118 | .subscribe( |
120 | 119 | n => (this.AfterInsertData(n)), |
... | ... | @@ -122,7 +121,8 @@ export class UpdateUserProfile implements OnInit { |
122 | 121 | } |
123 | 122 | } |
124 | 123 | AfterInsertData(data) { |
125 | - if (data.Status == "False") { | |
124 | + if (data.Status == "False") { | |
125 | + this._loadingService.HideLoading("global-loading"); | |
126 | 126 | return false; |
127 | 127 | } else { |
128 | 128 | this.status = true; |
... | ... | @@ -132,6 +132,7 @@ export class UpdateUserProfile implements OnInit { |
132 | 132 | loggedInUser.LastName = this.userFrm.value.lastName; |
133 | 133 | localStorage.setItem("loggedInUserDetails", JSON.stringify(loggedInUser)); |
134 | 134 | this.global.DisplayName = loggedInUser.FirstName + " " + loggedInUser.LastName; |
135 | + this._loadingService.HideLoading("global-loading"); | |
135 | 136 | this._confirmService.activate("User Profile Updated Successfully.", "alertMsg"); |
136 | 137 | |
137 | 138 | } |
... | ... | @@ -147,7 +148,8 @@ export class UpdateUserProfile implements OnInit { |
147 | 148 | this.userFrm.controls['id'].setValue(this.user.Id) |
148 | 149 | this.userFrm.controls['firstName'].setValue(this.user.FirstName) |
149 | 150 | this.userFrm.controls['lastName'].setValue(this.user.LastName) |
150 | - this.userFrm.controls['emailId'].setValue(this.user.EmailId) | |
151 | + this.userFrm.controls['emailId'].setValue(this.user.EmailId); | |
152 | + this._loadingService.HideLoading("global-loading"); | |
151 | 153 | } |
152 | 154 | |
153 | 155 | validationMessages = { | ... | ... |
400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts
... | ... | @@ -54,6 +54,20 @@ export class UserService { |
54 | 54 | } |
55 | 55 | //////////// End ///////////////////// |
56 | 56 | |
57 | + //////////Manage UserLogin Status/////////// | |
58 | + ManageUserLoginStatus(obj: any) { | |
59 | + var jsonData = { 'userId': obj.userId, 'tagName': obj.tagName,'isAlreadyLoggedIn': obj.isAlreadyLoggedIn }; | |
60 | + console.log(obj); | |
61 | + var headers = new Headers({ | |
62 | + 'Content-Type': 'application/json' | |
63 | + }); | |
64 | + return this.http.post(this.commonService.resourceBaseUrl + "User/ManageUserLoginStatus", | |
65 | + JSON.stringify(jsonData), { headers: headers }) | |
66 | + .map(this.extractData) | |
67 | + .catch((res: Response) => this.handleError(res)); | |
68 | + } | |
69 | + //////////// End ///////////////////// | |
70 | + | |
57 | 71 | |
58 | 72 | |
59 | 73 | //////////Update User Userid/////////////// |
... | ... | @@ -86,6 +100,7 @@ export class UserService { |
86 | 100 | "&accountnumber=" + obj.AccountNumber + |
87 | 101 | "&usertypeid=" + obj.UserTypeId + |
88 | 102 | "&accounttypeid=" + obj.AccountTypeId + |
103 | + "&userLoginStatus=" + obj.LoginStatus + | |
89 | 104 | "&pageNo=" + pageNo + |
90 | 105 | "&pageLength=" + pageLength + |
91 | 106 | "&iLoginUserType=" + this.commonService.UserType + | ... | ... |
400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html
... | ... | @@ -28,7 +28,7 @@ |
28 | 28 | <input type="text" class="form-control input-sm" id="LastNames" placeholder="Last Name" formControlName="LastName"> |
29 | 29 | </div> |
30 | 30 | </div> |
31 | - </div> | |
31 | + </div> | |
32 | 32 | </div> |
33 | 33 | </div> |
34 | 34 | <div class="col-lg-3 col-sm-3"> |
... | ... | @@ -80,6 +80,15 @@ |
80 | 80 | </div> |
81 | 81 | </div> |
82 | 82 | </div> |
83 | + | |
84 | + <div class="col-sm-12"> | |
85 | + <div class="form-group marginTop5"> | |
86 | + <label for="LoginStatus" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0">Logged-In Status :</label> | |
87 | + <div> | |
88 | + <input type="checkbox" class="radio-inline" style="height: 25px;width: 20px" id="LoginStatus" formControlName="LoginStatus"> | |
89 | + </div> | |
90 | + </div> | |
91 | + </div> | |
83 | 92 | </div> |
84 | 93 | </div> |
85 | 94 | |
... | ... | @@ -119,6 +128,7 @@ |
119 | 128 | <th>Account Number</th> |
120 | 129 | <th>Product Edition</th> |
121 | 130 | <th>Status</th> |
131 | + <th>Login Status</th> | |
122 | 132 | </tr> |
123 | 133 | </thead> |
124 | 134 | |
... | ... | @@ -143,6 +153,10 @@ |
143 | 153 | <span *ngIf="UserEntity.UserStatus=='Active'" class="label label-success">Active</span> |
144 | 154 | <span *ngIf="UserEntity.UserStatus!='Active'" class="label label-default">Inactive</span> |
145 | 155 | </td> |
156 | + <td> | |
157 | + <span *ngIf="UserEntity.LoginStatus==true" class="label label-success">Logged-In (Active Session: {{UserEntity.TotalLogin}})</span> | |
158 | + <span *ngIf="UserEntity.LoginStatus==false" class="label label-default">Logged-Out</span> | |
159 | + </td> | |
146 | 160 | </tr> |
147 | 161 | |
148 | 162 | |
... | ... | @@ -156,9 +170,11 @@ |
156 | 170 | <div [style.display]="(global.UserTypeName=='Super Admin') ? 'block' : 'none'"> |
157 | 171 | <button class="btn btn-primary btn-sm" (click)="EditManageUserRights()" [ngClass]="{disabled : !buttonStatus}"><i class="fa fa-thumbs-up"></i> Manage Rights</button> |
158 | 172 | <button class="btn btn-primary btn-sm" (click)="EditUser()" [ngClass]="{disabled : !EditbuttonStatus}"><i class="fa fa-edit"></i> Edit</button> |
173 | + <button class="btn btn-primary btn-sm" (click)="ForceLogoutUser()" [ngClass]="{disabled : !logoutUserSession}"><i class="fa fa-power-off"></i> Logout User</button> | |
159 | 174 | </div> |
160 | 175 | <div [style.display]="(global.UserTypeName!='Super Admin') ? 'block' : 'none'"> |
161 | 176 | <button class="btn btn-primary btn-sm" (click)="EditUser()" [ngClass]="{disabled : !EditbuttonStatus}"><i class="fa fa-edit"></i> Edit</button> |
177 | + <button class="btn btn-primary btn-sm" (click)="ForceLogoutUser()" [ngClass]="{disabled : !logoutUserSession}"><i class="fa fa-power-off"></i> Logout User</button> | |
162 | 178 | </div> |
163 | 179 | </div> |
164 | 180 | </div> | ... | ... |
400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts
... | ... | @@ -58,6 +58,7 @@ export class UsersList implements OnInit, AfterViewChecked { |
58 | 58 | UncheckedRecords: Array<number>; |
59 | 59 | buttonStatus: boolean; |
60 | 60 | EditbuttonStatus: boolean; |
61 | + logoutUserSession: boolean; | |
61 | 62 | //@ViewChild("profileModal") |
62 | 63 | //profileModal: ModalComponent; |
63 | 64 | //errorMessage: any; |
... | ... | @@ -81,7 +82,8 @@ export class UsersList implements OnInit, AfterViewChecked { |
81 | 82 | EmailId: [''], |
82 | 83 | AccountNumber: [''], |
83 | 84 | UserTypeId: [0], |
84 | - AccountTypeId:[0] | |
85 | + AccountTypeId:[0], | |
86 | + LoginStatus:[false] | |
85 | 87 | // Gender: ['', Validators.required], |
86 | 88 | // Email: [''] |
87 | 89 | |
... | ... | @@ -127,7 +129,6 @@ export class UsersList implements OnInit, AfterViewChecked { |
127 | 129 | this._loadingService.ShowLoading("global-loading"); |
128 | 130 | this.GetUserType(); |
129 | 131 | this.GetAccountType(); |
130 | - this._loadingService.HideLoading("global-loading"); | |
131 | 132 | this.recordCount = 0; |
132 | 133 | this.pageNo = 1; |
133 | 134 | this.pageLength = 10; |
... | ... | @@ -168,8 +169,6 @@ export class UsersList implements OnInit, AfterViewChecked { |
168 | 169 | testScript.setAttribute("type", "text/javascript"); |
169 | 170 | document.body.appendChild(testScript); |
170 | 171 | } |
171 | - | |
172 | - this._loadingService.HideLoading("global-loading"); | |
173 | 172 | |
174 | 173 | //this.GetUserList(); |
175 | 174 | } |
... | ... | @@ -234,6 +233,14 @@ export class UsersList implements OnInit, AfterViewChecked { |
234 | 233 | else { |
235 | 234 | this.buttonStatus = null; |
236 | 235 | } |
236 | + if (item['LoginStatus'] == true) { | |
237 | + this.logoutUserSession=true; | |
238 | + } | |
239 | + else{ | |
240 | + this.logoutUserSession = null; | |
241 | + } | |
242 | + | |
243 | + | |
237 | 244 | } |
238 | 245 | public SetClickedRowManageRight(j: number, item: any) { |
239 | 246 | |
... | ... | @@ -275,7 +282,6 @@ export class UsersList implements OnInit, AfterViewChecked { |
275 | 282 | var tempArr = evt.split(','); |
276 | 283 | this.pageNo = parseInt(tempArr[0]); |
277 | 284 | this.pageLength = parseInt(tempArr[1]); |
278 | - this._loadingService.ShowLoading("global-loading"); | |
279 | 285 | var UserFilterControl = this.Users.value; |
280 | 286 | |
281 | 287 | this.userservice.GetUserList( |
... | ... | @@ -285,13 +291,16 @@ export class UsersList implements OnInit, AfterViewChecked { |
285 | 291 | EmailId: this.Users.controls['EmailId'].value, |
286 | 292 | AccountNumber: this.Users.controls['AccountNumber'].value, |
287 | 293 | UserTypeId: (this.Users.controls['UserTypeId'].value != null && this.Users.controls['UserTypeId'].value !='' ? this.Users.controls['UserTypeId'].value:0), |
288 | - AccountTypeId: (this.Users.controls['AccountTypeId'].value != null && this.Users.controls['AccountTypeId'].value != ''? this.Users.controls['AccountTypeId'].value : 0), | |
294 | + AccountTypeId: (this.Users.controls['AccountTypeId'].value != null && this.Users.controls['AccountTypeId'].value != ''? this.Users.controls['AccountTypeId'].value : 0), | |
295 | + LoginStatus: this.Users.controls['LoginStatus'].value, | |
289 | 296 | },this.pageNo, this.pageLength |
290 | 297 | ) |
291 | 298 | .subscribe(x => { this.BindFormFields(x) }, error => this.error = <any>error); |
292 | 299 | |
293 | 300 | } |
294 | 301 | SearchRecords() { |
302 | + this.EditbuttonStatus=undefined; | |
303 | + this.logoutUserSession=undefined; | |
295 | 304 | this.buttonStatus = null; |
296 | 305 | this.selectedRow = -1; |
297 | 306 | this.SearchUserList('1, ' + this.pageLength); |
... | ... | @@ -309,12 +318,15 @@ export class UsersList implements OnInit, AfterViewChecked { |
309 | 318 | } |
310 | 319 | } |
311 | 320 | CancelEditUser() { |
312 | - this.SearchUserList('1, ' + this.pageLength); | |
321 | + this.SearchUserList(this.pageNo +','+ this.pageLength); | |
313 | 322 | this.Mode = 'Manage'; |
314 | 323 | this.modalTitle = 'LIST USER'; |
315 | 324 | this.topPos = '2000px'; |
316 | 325 | this.divClass = 'col-sm-12'; |
317 | 326 | this.selectedRow = -1; |
327 | + this.EditbuttonStatus=undefined; | |
328 | + this.buttonStatus=undefined; | |
329 | + this.logoutUserSession=undefined; | |
318 | 330 | } |
319 | 331 | EditUser() { |
320 | 332 | if (this.EditbuttonStatus) { |
... | ... | @@ -375,7 +387,24 @@ export class UsersList implements OnInit, AfterViewChecked { |
375 | 387 | //this.managerightFrm.contains['UserId'].setValue(this.UserEntity.Id); |
376 | 388 | |
377 | 389 | } |
378 | - | |
390 | + ForceLogoutUser(){ | |
391 | + if (this.logoutUserSession) { | |
392 | + this._loadingService.ShowLoading("global-loading"); | |
393 | + this.userservice.ManageUserLoginStatus({ | |
394 | + userId: this.selectedId, | |
395 | + tagName: 'logout', | |
396 | + isAlreadyLoggedIn:true | |
397 | + }).subscribe(x => { | |
398 | + console.log(x); | |
399 | + this.EditbuttonStatus=undefined; | |
400 | + this.logoutUserSession=undefined; | |
401 | + this.buttonStatus = null; | |
402 | + this.selectedRow = -1; | |
403 | + this.SearchUserList(this.pageNo +','+ this.pageLength); | |
404 | + | |
405 | + },error => console.log(error)); | |
406 | + } | |
407 | + } | |
379 | 408 | |
380 | 409 | public UpdateUser() { |
381 | 410 | this.alerts = ''; | ... | ... |
400-SOURCECODE/Admin/src/app/shared/global.ts
... | ... | @@ -24,6 +24,9 @@ export class GlobalService { |
24 | 24 | AccLicId: number = 0; |
25 | 25 | LoginId:string=""; |
26 | 26 | ProtocolType:string=""; |
27 | + aiaIdleTime:number=0; | |
28 | + aiaIdleTimeOut:number=0; | |
29 | + aiaPingInterval:number=0; | |
27 | 30 | RemoveColumns: Array<string> = ["Serial_No", "LicenseId","RowNum"] |
28 | 31 | error; |
29 | 32 | public href: string = ""; |
... | ... | @@ -35,11 +38,15 @@ export class GlobalService { |
35 | 38 | this.UserTypeName = this.loggedInUser.UserType; |
36 | 39 | this.DisplayName = this.loggedInUser.FirstName + " " + this.loggedInUser.LastName; |
37 | 40 | this.LoginId=this.loggedInUser.LoginId; |
41 | + this.aiaIdleTime=this.loggedInUser.aiaIdleTime; | |
42 | + this.aiaIdleTimeOut=this.loggedInUser.aiaIdleTimeOut; | |
43 | + this.aiaPingInterval=this.loggedInUser.aiaPingInterval; | |
44 | + | |
38 | 45 | } |
39 | 46 | |
40 | 47 | this.NoRecords = 'No Record Found.'; |
41 | 48 | |
42 | - this.hostURL = "http://192.168.81.63:92/API/Adminapi/";//Birendra Machine IP | |
49 | + this.hostURL = "http://192.168.43.9/API/Adminapi/";//Birendra Machine IP | |
43 | 50 | this.LiveAPIURL = "http://interactiveanatomy.com/API/Adminapi/"; |
44 | 51 | this.QAAPIURL = "http://qa.beta.interactiveanatomy.com/API/Adminapi/"; |
45 | 52 | this.LocalURL = "http://localhost:4200"; |
... | ... | @@ -49,6 +56,7 @@ export class GlobalService { |
49 | 56 | |
50 | 57 | if(window.location.hostname=="localhost") |
51 | 58 | { |
59 | + // for 'ng serve --open' command | |
52 | 60 | //**** for localhost:4200 *****// |
53 | 61 | this.resourceBaseUrl = this.hostURL; |
54 | 62 | } |
... | ... | @@ -59,13 +67,14 @@ export class GlobalService { |
59 | 67 | |
60 | 68 | } |
61 | 69 | |
62 | - if (this.resourceBaseUrl == this.ProtocolType+"192.168.81.63:92/API/Adminapi/") { | |
70 | + if (this.resourceBaseUrl == this.ProtocolType+"192.168.43.9/API/Adminapi/") { | |
63 | 71 | if(window.location.hostname=="localhost") |
64 | 72 | { |
73 | + // for 'ng serve --open' command | |
65 | 74 | //**** for localhost:4200 *****// |
66 | 75 | localStorage.setItem('loggedInUserDetails', JSON.stringify( |
67 | 76 | { |
68 | - "Id": 1, "FirstName": "Maribel", "LastName": "sfsfsfsfsfsfs", "EmailId": "ravi.vishwakarma@ebix.com", "LoginId": "superadmin", "Password": "ebix@2016", "SecurityQuestionId": 1, "SecurityAnswer": "boxer", "CreatorId": 1, "CreationDate": "2009-03-02T00:00:00", "DeactivationDate": null, "ModifierId": 1, "ModifiedDate": "2017-01-24T02:03:19", "UserType": "Super Admin", "UserTypeId": 1, "IsActive": true, "IsCorrectPassword": false, "IncorrectLoginAttemptCount": 0, "IsBlocked": false, "LicenseId": 0, "EditionId": 0, "LoginFailureCauseId": 0, "Modules": [{ "slug": "da-view-list", "name": "Dissectible Anatomy", "id": 1 }, { "slug": "tile-view-list", "name": "Atlas Anatomy", "id": 2 }, { "slug": "3d-anatomy-list", "name": "3D Anatomy", "id": 3 }, { "slug": "clinical-illustrations", "name": "Clinical Illustrations", "id": 4 }, { "slug": "clinical-animations", "name": "Clinical Animations", "id": 5 }, { "slug": "Link/encyclopedia", "name": "Encyclopedia", "id": 6 }, { "slug": "curriculum-builder", "name": "Curriculum Builder", "id": 7 }, { "slug": "anatomy-test", "name": "Anatomy Test", "id": 8 }, { "slug": "Link/IP-10", "name": "IP 10", "id": 9 }, { "slug": "lab-exercises", "name": "Lab Exercises", "id": 10 }, { "slug": "Link/indepth-reports", "name": "In-Depth Reports", "id": 11 }, { "slug": "Link/complementary-and-alternate-medicine", "name": "CAM", "id": 12 }, { "slug": "ADAM-images", "name": "A.D.A.M. Images", "id": 13 }, { "slug": "Link/bodyguide", "name": "Body Guide", "id": 14 }, { "slug": "Link/health-navigator", "name": "Symptom Navigator", "id": 15 }, { "slug": "Link/wellness-tools", "name": "The Wellness Tools", "id": 16 }, { "slug": "Link/aod", "name": "A.D.A.M. OnDemand", "id": 1017 }], "LicenseInfo": { "Id": 0, "AccountNumber": "AIAS000319" }, "LicenseSubscriptions": null, "IsSubscriptionExpired": false, "SubscriptionExpirationDate": null, "TermsAndConditionsTitle": null, "TermsAndConditionsText": null | |
77 | + "Id": 1, "FirstName": "Maribel", "LastName": "sfsfsfsfsfsfs", "EmailId": "ravi.vishwakarma@ebix.com", "LoginId": "superadmin", "Password": "ebix@2016","aiaIdleTime": 300,"aiaIdleTimeOut": 30,"aiaPingInterval": 10, "SecurityQuestionId": 1, "SecurityAnswer": "boxer", "CreatorId": 1, "CreationDate": "2009-03-02T00:00:00", "DeactivationDate": null, "ModifierId": 1, "ModifiedDate": "2017-01-24T02:03:19", "UserType": "Super Admin", "UserTypeId": 1, "IsActive": true, "IsCorrectPassword": false, "IncorrectLoginAttemptCount": 0, "IsBlocked": false, "LicenseId": 0, "EditionId": 0, "LoginFailureCauseId": 0, "Modules": [{ "slug": "da-view-list", "name": "Dissectible Anatomy", "id": 1 }, { "slug": "tile-view-list", "name": "Atlas Anatomy", "id": 2 }, { "slug": "3d-anatomy-list", "name": "3D Anatomy", "id": 3 }, { "slug": "clinical-illustrations", "name": "Clinical Illustrations", "id": 4 }, { "slug": "clinical-animations", "name": "Clinical Animations", "id": 5 }, { "slug": "Link/encyclopedia", "name": "Encyclopedia", "id": 6 }, { "slug": "curriculum-builder", "name": "Curriculum Builder", "id": 7 }, { "slug": "anatomy-test", "name": "Anatomy Test", "id": 8 }, { "slug": "Link/IP-10", "name": "IP 10", "id": 9 }, { "slug": "lab-exercises", "name": "Lab Exercises", "id": 10 }, { "slug": "Link/indepth-reports", "name": "In-Depth Reports", "id": 11 }, { "slug": "Link/complementary-and-alternate-medicine", "name": "CAM", "id": 12 }, { "slug": "ADAM-images", "name": "A.D.A.M. Images", "id": 13 }, { "slug": "Link/bodyguide", "name": "Body Guide", "id": 14 }, { "slug": "Link/health-navigator", "name": "Symptom Navigator", "id": 15 }, { "slug": "Link/wellness-tools", "name": "The Wellness Tools", "id": 16 }, { "slug": "Link/aod", "name": "A.D.A.M. OnDemand", "id": 1017 }], "LicenseInfo": { "Id": 0, "AccountNumber": "AIAS000319" }, "LicenseSubscriptions": null, "IsSubscriptionExpired": false, "SubscriptionExpirationDate": null, "TermsAndConditionsTitle": null, "TermsAndConditionsText": null | |
69 | 78 | })); |
70 | 79 | } |
71 | 80 | ... | ... |
400-SOURCECODE/Admin/src/assets/styles/bootstrap.css
... | ... | @@ -1325,13 +1325,13 @@ pre code { |
1325 | 1325 | width: 50%; |
1326 | 1326 | } |
1327 | 1327 | .col-lg-5 { |
1328 | - width: 41.66666667%; | |
1328 | + width: 50.66666667%; | |
1329 | 1329 | } |
1330 | 1330 | .col-lg-4 { |
1331 | 1331 | width: 33.33333333%; |
1332 | 1332 | } |
1333 | 1333 | .col-lg-3 { |
1334 | - width: 25%; | |
1334 | + width: 27%; | |
1335 | 1335 | } |
1336 | 1336 | .col-lg-2 { |
1337 | 1337 | width: 16.66666667%; | ... | ... |