diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs index 4c5f9f3..2667aed 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs @@ -30,9 +30,14 @@ namespace AIAHTML5.API.Controllers HttpResponseMessage response = null; int siteId = AIAHTML5.API.Models.Users.ValidateLicenseSiteIP(siteUrl["siteIP"].ToString(), siteUrl["remoteIPAddress"].ToString(), siteUrl["accountNumber"].ToString(), Convert.ToByte(siteUrl["edition"].ToString())); - int x = AIAHTML5.API.Models.Users.ValidateSiteLogin(siteUrl["siteIP"].ToString(),siteUrl["accountNumber"].ToString(),siteUrl["urlReferer"].ToString(),siteUrl["edition"].ToString(),siteId) - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.VALIDATED_CLIENT) }; - + if (siteId > 0) + { + dynamic uerinfo = AIAHTML5.API.Models.Users.ValidateSiteLogin(siteUrl["siteIP"].ToString(), siteUrl["accountNumber"].ToString(), siteUrl["urlReferer"].ToString(), siteUrl["edition"].ToString(), siteId); + if (uerinfo != null) + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(uerinfo) }; + else + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.INVALID_CLIENT) }; + } return response; } diff --git a/400-SOURCECODE/AIAHTML5.API/Models/IPValidator.cs b/400-SOURCECODE/AIAHTML5.API/Models/IPValidator.cs index ff1f8b9..44785c7 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/IPValidator.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/IPValidator.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.RegularExpressions; using System.Web; namespace AIAHTML5.API.Models diff --git a/400-SOURCECODE/AIAHTML5.API/Models/User.cs b/400-SOURCECODE/AIAHTML5.API/Models/User.cs index 4ad2492..a6898d8 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/User.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/User.cs @@ -18,7 +18,7 @@ namespace AIAHTML5.API.Models public byte LicenseTypeId { get; set; } public bool Modesty { get; set; } public bool ModestyMode { get; set; } - public Hashtable objEditionFeatures { get;set} + public Hashtable objEditionFeatures { get; set; } public int? SecurityQuestionId { get; set; } public string SecurityAnswer { get; set; } public int? CreatorId { get; set; } diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs index a9e1b17..6e6babb 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs @@ -24,22 +24,22 @@ namespace AIAHTML5.API.Models logger.Debug("inside AuthenticateUser for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString()); dynamic userDetails = null; - - User user = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString()); - //string userDetails = DBModel.GetUserDetailsByLoginId2(credentials["username"].ToString()); - if (user != null) - { - logger.Debug("userDetails.loginId= " + user.LoginId); // .loginId); + User user = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString()); + //string userDetails = DBModel.GetUserDetailsByLoginId2(credentials["username"].ToString()); + + if (user != null) + { + logger.Debug("userDetails.loginId= " + user.LoginId); // .loginId); + + userDetails = JsonConvert.SerializeObject(user); + } + else + { + userDetails = AIAConstants.USER_NOT_FOUND; + } - userDetails = JsonConvert.SerializeObject(user); - } - else - { - userDetails = AIAConstants.USER_NOT_FOUND; - } - return userDetails; } @@ -47,32 +47,32 @@ namespace AIAHTML5.API.Models { logger.Debug(" inside GetUserByEmail for emailId = " + userInfo["emailId"]); - - User objUser = DBModel.GetUserDetailsByEmailId(userInfo["emailId"].ToString()); - //dynamic userDetails; + User objUser = DBModel.GetUserDetailsByEmailId(userInfo["emailId"].ToString()); + + //dynamic userDetails; + + if (objUser != null) + { + logger.Debug("userDetails.loginId= " + objUser.LoginId); + //return userDetails = JsonConvert.SerializeObject(objUser); + return objUser; + } + else + { + return AIAConstants.USER_NOT_FOUND; + } - if (objUser!= null) - { - logger.Debug("userDetails.loginId= " + objUser.LoginId); - //return userDetails = JsonConvert.SerializeObject(objUser); - return objUser; - } - else - { - return AIAConstants.USER_NOT_FOUND; - } - } internal static dynamic UpdatePassword(Newtonsoft.Json.Linq.JObject userInfo, string sLoginId, string sEmailId) { - - int result = DBModel.UpdateUserPassword(userInfo, sLoginId, sEmailId); - return result; - + int result = DBModel.UpdateUserPassword(userInfo, sLoginId, sEmailId); + + return result; + } internal static dynamic UpdateLicenseTerm(Newtonsoft.Json.Linq.JObject userLicenseInfo) @@ -85,13 +85,13 @@ namespace AIAHTML5.API.Models userInfo.Add("accountNumber", accountNumber); - - result = DBModel.UpdateLicenseTermStatus(accountNumber); - if (result < 0) - { - logger.Fatal("Unable to update LicenseTermAccepted status for AccountNumber =" + accountNumber); - } + result = DBModel.UpdateLicenseTermStatus(accountNumber); + + if (result < 0) + { + logger.Fatal("Unable to update LicenseTermAccepted status for AccountNumber =" + accountNumber); + } return result; } @@ -108,10 +108,10 @@ namespace AIAHTML5.API.Models logger.Debug("inside getUserDetails for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString()); User userDetails = null; - - userDetails = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString()); - return userDetails; + userDetails = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString()); + + return userDetails; } internal static void getLicenseIdForThisUser(int userId, out int licenseId, out int editionId) @@ -122,18 +122,18 @@ namespace AIAHTML5.API.Models licenseId = 0; editionId = 0; - - DBModel objModel = new DBModel(); - Hashtable licenseEditionHash = objModel.GetLicenseDetailByUserId(userId); - if (licenseEditionHash.ContainsKey(AIAConstants.LICENSE_KEY_ID)) - licenseId = Convert.ToInt32(licenseEditionHash[AIAConstants.LICENSE_KEY_ID]); + DBModel objModel = new DBModel(); + Hashtable licenseEditionHash = objModel.GetLicenseDetailByUserId(userId); + + if (licenseEditionHash.ContainsKey(AIAConstants.LICENSE_KEY_ID)) + licenseId = Convert.ToInt32(licenseEditionHash[AIAConstants.LICENSE_KEY_ID]); + + if (licenseEditionHash.ContainsKey(AIAConstants.EDITION_KEY_ID)) + editionId = Convert.ToInt32(licenseEditionHash[AIAConstants.EDITION_KEY_ID]); + - if (licenseEditionHash.ContainsKey(AIAConstants.EDITION_KEY_ID)) - editionId = Convert.ToInt32(licenseEditionHash[AIAConstants.EDITION_KEY_ID]); - - } internal static int insertLoginDetails(int userId) @@ -141,12 +141,12 @@ namespace AIAHTML5.API.Models logger.Debug("inside insertLoginDetails for UserId =" + userId); int result = 0; - - DBModel objModel = new DBModel(); - result = objModel.InsertLoginDetails(userId); - - return result; + DBModel objModel = new DBModel(); + + result = objModel.InsertLoginDetails(userId); + + return result; } internal static bool isUSerActive(User user) @@ -162,7 +162,7 @@ namespace AIAHTML5.API.Models expirationDate = string.Empty; bool isLicenseExpired = false; - if (subscriptionDetail!= null) + if (subscriptionDetail != null) { DateTime? subscriptionValidThrough = subscriptionDetail.SubscriptionValidThrough; if (subscriptionValidThrough != null && subscriptionValidThrough.Value.Date >= DateTime.Now.Date) @@ -173,7 +173,7 @@ namespace AIAHTML5.API.Models { isLicenseExpired = true; expirationDate = subscriptionDetail.SubscriptionValidThrough.Value.Date.ToString("MM/dd/yyyy").ToString(); - } + } } return isLicenseExpired; } @@ -184,13 +184,13 @@ namespace AIAHTML5.API.Models ArrayList licensedModulesList = new ArrayList(); - - DBModel objModel = new DBModel(); - licensedModulesList = objModel.GetUserModulesByLicenseId(licenseId); - - return licensedModulesList; + DBModel objModel = new DBModel(); + licensedModulesList = objModel.GetUserModulesByLicenseId(licenseId); + + + return licensedModulesList; } internal static int deletePastWrongAttempts(int userId) @@ -199,10 +199,10 @@ namespace AIAHTML5.API.Models int result = 0; - - DBModel objModel = new DBModel(); - result = objModel.DeleteIncorrectLoginAttempts(userId); - return result; + + DBModel objModel = new DBModel(); + result = objModel.DeleteIncorrectLoginAttempts(userId); + return result; } internal static int checkNoOfWrongAttempts(int userId) @@ -211,10 +211,10 @@ namespace AIAHTML5.API.Models int incorrectLoginAttemptCount = 0; - - DBModel objModel = new DBModel(); - incorrectLoginAttemptCount = objModel.GetIncorrectLoginAttempts(userId); - return incorrectLoginAttemptCount; + + DBModel objModel = new DBModel(); + incorrectLoginAttemptCount = objModel.GetIncorrectLoginAttempts(userId); + return incorrectLoginAttemptCount; } internal static int saveWrongAttemptOfUser(int userId, int previousIncorrectLoginAttempts) @@ -222,18 +222,18 @@ namespace AIAHTML5.API.Models logger.Debug("inside saveWrongAttemptofUser for UserId =" + userId); int result = 0; - - DBModel objModel = new DBModel(); - if (previousIncorrectLoginAttempts < 1) - { - result = objModel.InsertIncorrectLoginAttempts(userId); - } - else - { - result = objModel.UpdateIncorrectLoginAttempts(userId); - } - + DBModel objModel = new DBModel(); + + if (previousIncorrectLoginAttempts < 1) + { + result = objModel.InsertIncorrectLoginAttempts(userId); + } + else + { + result = objModel.UpdateIncorrectLoginAttempts(userId); + } + return result; } @@ -243,16 +243,16 @@ namespace AIAHTML5.API.Models logger.Debug("inside isLicenseActive for LicenseId =" + licenseId); bool result = false; - DBModel objModel = new DBModel(); - License userLicense = objModel.GetLicenseDetailsByLicenseId(licenseId); + DBModel objModel = new DBModel(); + License userLicense = objModel.GetLicenseDetailsByLicenseId(licenseId); - if (userLicense.IsActive) - result = true; - else - result = false; - - return result; + if (userLicense.IsActive) + result = true; + else + result = false; + + return result; } internal static License getLicenseDetails(int licenseId) @@ -261,11 +261,11 @@ namespace AIAHTML5.API.Models License userLicense = null; - - DBModel objModel = new DBModel(); - userLicense = objModel.GetLicenseDetailsByLicenseId(licenseId); - - return userLicense; + + DBModel objModel = new DBModel(); + userLicense = objModel.GetLicenseDetailsByLicenseId(licenseId); + + return userLicense; } internal static LicenseSubscriptionDetails getLicenseSubscriptionDetails(int licenseId) @@ -274,19 +274,19 @@ namespace AIAHTML5.API.Models LicenseSubscriptionDetails userSubscriptionDetail = null; - - DBModel objModel = new DBModel(); - userSubscriptionDetail = objModel.GetLicenseSubscriptionDetailsByLicenseId(licenseId); - + + DBModel objModel = new DBModel(); + userSubscriptionDetail = objModel.GetLicenseSubscriptionDetailsByLicenseId(licenseId); + return userSubscriptionDetail; } internal static void isCredentialCorrect(Newtonsoft.Json.Linq.JObject credentials, User userInfo, out bool isCorrectLoginId, out bool isCorrectPassword) { isCorrectLoginId = false; - isCorrectPassword = false; + isCorrectPassword = false; - if (userInfo.Id> 0) + if (userInfo.Id > 0) { if (string.Equals(credentials["username"].ToString().ToUpper(), userInfo.LoginId.ToUpper())) isCorrectLoginId = true; @@ -304,10 +304,10 @@ namespace AIAHTML5.API.Models int result = 0; - - DBModel objModel = new DBModel(); - result = objModel.InsertUserLoginLog(accountNumber, failureId, null, edition, null); - + + DBModel objModel = new DBModel(); + result = objModel.InsertUserLoginLog(accountNumber, failureId, null, edition, null); + return result; } @@ -318,21 +318,21 @@ namespace AIAHTML5.API.Models ArrayList arrTermsOfService = new ArrayList(); - DBModel objModel = new DBModel(); - arrTermsOfService = DBModel.GetTermsAndConditions(); - + DBModel objModel = new DBModel(); + arrTermsOfService = DBModel.GetTermsAndConditions(); + return arrTermsOfService; } internal static ArrayList getAllModulesList() { logger.Debug("inside getAllModulesList"); - ArrayList modulesList = new ArrayList (); + ArrayList modulesList = new ArrayList(); + + + DBModel objModel = new DBModel(); + modulesList = objModel.GetAllModules(); - - DBModel objModel = new DBModel(); - modulesList = objModel.GetAllModules(); - return modulesList; } @@ -342,18 +342,18 @@ namespace AIAHTML5.API.Models bool isUserBlocked = false; blockTime = new DateTime(); - - DBModel objModel = new DBModel(); - BlockedUser blockedUser = objModel.GetUserBlockedStatusByUserId(userId); - if (blockedUser!= null) - { - blockTime = blockedUser.LoginTime; - isUserBlocked = true; - } - else - isUserBlocked = false; - + DBModel objModel = new DBModel(); + BlockedUser blockedUser = objModel.GetUserBlockedStatusByUserId(userId); + + if (blockedUser != null) + { + blockTime = blockedUser.LoginTime; + isUserBlocked = true; + } + else + isUserBlocked = false; + return isUserBlocked; } @@ -365,10 +365,10 @@ namespace AIAHTML5.API.Models strLicenseSiteIP = remoteIpAddress; int intReturn = 0; - DBModel objDBModel = new DBModel(); - DataTable dtLicense = objDBModel.GetLicenseInfoBySiteUrl(strAccountNumber, (byte)editionId); + DBModel objDBModel = new DBModel(); + DataTable dtLicense = objDBModel.GetLicenseInfoBySiteUrl(strAccountNumber, (byte)editionId); - if (dtLicense.Rows.Count > 0) + if (dtLicense.Rows.Count > 0) { //strLicenseSiteIP String strSiteIP = ""; @@ -434,144 +434,169 @@ namespace AIAHTML5.API.Models } return intReturn; } - - public static int ValidateSiteLogin( String strSiteIP, String strAcccountNumber,String strUrlReferer,string strEdition,int intSiteId ) { + + public static User ValidateSiteLogin(String strSiteIP, String strAcccountNumber, String strUrlReferer, string strEdition, int intSiteId) + { Int32 intUserId = 0; - bool isExpired ; - try { - Int16 intErrorID = ErrorHelper.E_NO_ERROR; - String strStatus = AIAConstants.STATUS_OK; - - int intLicenseId = 0; - int intEditionId = Convert.ToInt16(strEdition); - - DateTime dtLogDate = DateTime.Now; - //strSiteIP = (String)objRequest.GetData(AIAConstants.SITE_IP); - //strAcccountNumber = (String)objRequest.GetData(AIAConstants.ACCOUNT_NUMBER); - //intEditionId = Convert.ToInt16(objRequest.GetData(AIAConstants.EDITION_ID)); - //strUrlReferer = (String)objRequest.GetData(AIAConstants.URL_REFERER); - //strEdition = (String)objRequest.GetData(AIAConstants.EDITION_ID); - //intSiteId = (Int32)objRequest.GetData(AIAConstants.SITE_ID); - //AdminDAL.AdminDal.GetLicenseBySiteIdDataTable dtLicense = new ADAM.AIA50.AdminDAL.AdminDal.GetLicenseBySiteIdDataTable(); - if (string.IsNullOrEmpty(strAcccountNumber)) { - //----logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, ErrorHelper.ACCOUNT_NUMBER_NOT_NULL, strSiteIP, strEdition, strUrlReferer); - intErrorID = ErrorHelper.E_ACCOUNT_NUMBER_NOT_NULL; - strStatus = AIAConstants.STATUS_NOT_OK; - } else if (string.IsNullOrEmpty(strEdition)) { - strEdition = "0"; - //----logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, ErrorHelper.EDITION_ID_NOT_NULL, strSiteIP, strEdition, strUrlReferer); - intErrorID = ErrorHelper.E_EDITION_ID_NOT_NULL; - strStatus = AIAConstants.STATUS_NOT_OK; - } - else { - DBModel objDBModel = new DBModel(); - DataTable dtLicense = objDBModel.GetLicenseBySiteId(intSiteId); - if (dtLicense.Rows.Count > 0) { - foreach (DataRow licRow in dtLicense.Rows) + bool isExpired = false; + User userInfo = null; + //try { + Int16 intErrorID = ErrorHelper.E_NO_ERROR; + String strStatus = AIAConstants.STATUS_OK; + + int intLicenseId = 0; + int intEditionId = Convert.ToInt16(strEdition); + + DateTime dtLogDate = DateTime.Now; + //strSiteIP = (String)objRequest.GetData(AIAConstants.SITE_IP); + //strAcccountNumber = (String)objRequest.GetData(AIAConstants.ACCOUNT_NUMBER); + //intEditionId = Convert.ToInt16(objRequest.GetData(AIAConstants.EDITION_ID)); + //strUrlReferer = (String)objRequest.GetData(AIAConstants.URL_REFERER); + //strEdition = (String)objRequest.GetData(AIAConstants.EDITION_ID); + //intSiteId = (Int32)objRequest.GetData(AIAConstants.SITE_ID); + //AdminDAL.AdminDal.GetLicenseBySiteIdDataTable dtLicense = new ADAM.AIA50.AdminDAL.AdminDal.GetLicenseBySiteIdDataTable(); + if (string.IsNullOrEmpty(strAcccountNumber)) + { + //----logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, ErrorHelper.ACCOUNT_NUMBER_NOT_NULL, strSiteIP, strEdition, strUrlReferer); + //intErrorID = ErrorHelper.E_ACCOUNT_NUMBER_NOT_NULL; + //strStatus = AIAConstants.STATUS_NOT_OK; + + userInfo.LoginFailureCauseId = ErrorHelper.E_ACCOUNT_NUMBER_NOT_NULL; + } + else if (string.IsNullOrEmpty(strEdition)) + { + strEdition = "0"; + //----logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, ErrorHelper.EDITION_ID_NOT_NULL, strSiteIP, strEdition, strUrlReferer); + //intErrorID = ErrorHelper.E_EDITION_ID_NOT_NULL; + //strStatus = AIAConstants.STATUS_NOT_OK; + userInfo.LoginFailureCauseId = ErrorHelper.E_EDITION_ID_NOT_NULL; + + } + else + { + DBModel objDBModel = new DBModel(); + DataTable dtLicense = objDBModel.GetLicenseBySiteId(intSiteId); + if (dtLicense.Rows.Count > 0) + { + //foreach (DataRow licRow in dtLicense.Rows) + //{ + DataRow licRow = dtLicense.Rows[0]; + //isExpired = LicenseHelper.IsLicenseExpired(licRow["Id"]); + userInfo = new User(); + userInfo.LicenseInfo = AIAHTML5.API.Models.Users.getLicenseDetails(Convert.ToInt32(licRow["Id"])); + + if (userInfo.LicenseInfo != null) + { + //05.3 get licenseSubscription details + userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails(userInfo.LicenseId); + + //05.4 check the License expiration irespective of either user is active or not because on AIA + //we shows the License expiration message for inactive users too + + + if (userInfo.LicenseSubscriptions != null) { - - //isExpired = LicenseHelper.IsLicenseExpired(licRow["Id"]); - User userInfo = new User(); - userInfo.LicenseInfo = AIAHTML5.API.Models.Users.getLicenseDetails(Convert.ToInt32(licRow["Id"])); + DateTime? subscriptionValidThrough = userInfo.LicenseSubscriptions.SubscriptionValidThrough; + if (subscriptionValidThrough != null && subscriptionValidThrough.Value.Date >= DateTime.Now.Date) + { + isExpired = false; + } + else + { + isExpired = true; + } + } - if (userInfo.LicenseInfo != null) + + + if (!isExpired && Convert.ToBoolean(licRow["IsActive"]) == true) + { + //User objUserContext = new User(); + userInfo.Id = 0; + userInfo.FirstName = licRow["LicenseeFirstName"].ToString(); + userInfo.LastName = licRow["LicenseeLastName"].ToString(); + userInfo.UserTypeId = AIAConstants.SITE_USER; + if (licRow["EmailId"].ToString() != null) { - //05.3 get licenseSubscription details - userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails(userInfo.LicenseId); + userInfo.EmailId = licRow["EmailId"].ToString(); + } + else + { + userInfo.EmailId = null; + } + userInfo.AccountNumber = strAcccountNumber; + userInfo.EditionId = (Byte)intEditionId; + userInfo.LicenseTypeId = (byte)licRow["LicenseTypeId"]; + userInfo.LicenseId = Convert.ToInt32(licRow["Id"]); + userInfo.LoginId = ""; + userInfo.Modesty = (bool)licRow["IsModesty"]; + //Retreive ModestyMode + userInfo.ModestyMode = false; - //05.4 check the License expiration irespective of either user is active or not because on AIA - //we shows the License expiration message for inactive users too - + intLicenseId = Convert.ToInt32(licRow["Id"]); - if (userInfo.LicenseSubscriptions != null) - { - DateTime? subscriptionValidThrough = userInfo.LicenseSubscriptions.SubscriptionValidThrough; - if (subscriptionValidThrough != null && subscriptionValidThrough.Value.Date >= DateTime.Now.Date) - { - isExpired = false; - } - else - { - isExpired = true; - } - } - - - if (!isExpired && Convert.ToBoolean(licRow["IsActive"]) == true) { - User objUserContext = new User(); - objUserContext.Id = 0; - objUserContext.FirstName = licRow["LicenseeFirstName"].ToString(); - objUserContext.LastName = licRow["LicenseeLastName"].ToString(); - objUserContext.UserTypeId = AIAConstants.SITE_USER; - if (licRow["EmailId"].ToString()!= null) - { - objUserContext.EmailId = licRow["EmailId"].ToString(); - } else { - objUserContext.EmailId = null; + DataTable dtblEditionForModesty = new DBModel().GetEditionsForModesty(userInfo.LicenseId, 0); + //This table result set should return always have 0 or 1 record if modesty mode is present. + foreach (DataRow drEditionForModesty in dtblEditionForModesty.Rows) + { + if ((bool)drEditionForModesty["IsModesty"]) + { + userInfo.Modesty = true; + userInfo.ModestyMode = true; } - objUserContext.AccountNumber = strAcccountNumber; - objUserContext.EditionId = (Byte)intEditionId; - objUserContext.LicenseTypeId = (byte)licRow["LicenseTypeId"]; - objUserContext.LicenseId = Convert.ToInt32(licRow["Id"]); - objUserContext.LoginId = ""; - objUserContext.Modesty =(bool)licRow["IsModesty"]; - //Retreive ModestyMode - objUserContext.ModestyMode = false; - - intLicenseId = Convert.ToInt32(licRow["Id"]); - - - DataTable dtblEditionForModesty = new DBModel().GetEditionsForModesty(objUserContext.LicenseId, 0); - //This table result set should return always have 0 or 1 record if modesty mode is present. - foreach (DataRow drEditionForModesty in dtblEditionForModesty.Rows) { - if ((bool)drEditionForModesty["IsModesty"]) { - objUserContext.Modesty = true; - objUserContext.ModestyMode = true; } - } - // get edition features details - objUserContext.objEditionFeatures = objDBModel.GetEditionFeatures((Byte)intEditionId); + // get edition features details + userInfo.objEditionFeatures = objDBModel.GetEditionFeatures((Byte)intEditionId); - - if (intLicenseId > 0) - objUserContext.Modules = getModuleListByLicenseId(intLicenseId); - else - objUserContext.Modules = getAllModulesList(); - objResponse.AddData(LoginConst.USER_CONTEXT, objUserContext); - // SessionManager.GetInstance().AddSession((int)0, (int)objLicenseRow.Id, (byte)intEditionId); + if (intLicenseId > 0) + userInfo.Modules = getModuleListByLicenseId(intLicenseId); + else + userInfo.Modules = getAllModulesList(); + + // objResponse.AddData(LoginConst.USER_CONTEXT, objUserContext); - // Hashtable arrModuleList = LicenseHelper.GetInstance().GetAllModuleByLicenseId(objLicenseRow.Id); - //if (arrModuleList[9].Equals(true)) { - // SessionManager.GetInstance().AddModSession("ModuleNameIP10", "IP10"); - //} + // Hashtable arrModuleList = LicenseHelper.GetInstance().GetAllModuleByLicenseId(objLicenseRow.Id); + //if (arrModuleList[9].Equals(true)) { + // SessionManager.GetInstance().AddModSession("ModuleNameIP10", "IP10"); + //} - //logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, 0, strSiteIP, strEdition, strUrlReferer); - } else { - // logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, ErrorHelper.LICENSE_INACTIVE, strSiteIP, Convert.ToString(intEditionId), strUrlReferer); - intErrorID = ErrorHelper.E_LICENCE_IS_INACTIVE; - strStatus = AIAConstants.STATUS_NOT_OK; + //logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, 0, strSiteIP, strEdition, strUrlReferer); + } + else + { + // logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, ErrorHelper.LICENSE_INACTIVE, strSiteIP, Convert.ToString(intEditionId), strUrlReferer); + // intErrorID = ErrorHelper.E_LICENCE_IS_INACTIVE; + // strStatus = AIAConstants.STATUS_NOT_OK; + userInfo.LoginFailureCauseId = ErrorHelper.LICENSE_INACTIVE; + } } - } else { - - intErrorID = ErrorHelper.E_EDITION_NOT_LINKED_WITH_SITE; - strStatus = AIAConstants.STATUS_NOT_OK; - } + else + { + + // intErrorID = ErrorHelper.E_EDITION_NOT_LINKED_WITH_SITE; + // strStatus = AIAConstants.STATUS_NOT_OK; + userInfo.LoginFailureCauseId = ErrorHelper.E_EDITION_NOT_LINKED_WITH_SITE; + } + //} } - objResponse.ErrorCode = intErrorID; - objResponse.Status = strStatus; - objResponse.ErrorDesc = ErrorHelper.GetInstance().GetErrorDescriptionHelper(intErrorID).ToString(); - } catch (Exception objExp) { - objResponse.Status = GlobalConstant.STATUS_NOT_OK; - objResponse.ErrorCode = GlobalConstant.RUN_TIME_EXCEPTION; - objResponse.strErrorDesc = objExp.Message; } - if (isExpired != null && (bool)isExpired["result"]) - objResponse.strErrorDesc = objResponse.strErrorDesc.Replace("{0}", (string)isExpired["date"]); - return intUserId; + //objResponse.ErrorCode = intErrorID; + //objResponse.Status = strStatus; + //objResponse.ErrorDesc = ErrorHelper.GetInstance().GetErrorDescriptionHelper(intErrorID).ToString(); + //} catch (Exception objExp) { + // objResponse.Status = GlobalConstant.STATUS_NOT_OK; + // objResponse.ErrorCode = GlobalConstant.RUN_TIME_EXCEPTION; + // objResponse.strErrorDesc = objExp.Message; + //} + //if (isExpired != null && (bool)isExpired["result"]) + // objResponse.strErrorDesc = objResponse.strErrorDesc.Replace("{0}", (string)isExpired["date"]); + //return intUserId; + return userInfo; + } } } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index aa08cf6..e51ef7a 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -136,26 +136,26 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A $scope.ValidateClientSiteUrl(); } - - - if (navigator.cookieEnabled) { - - $rootScope.isLoading = false; - var url = $location.url(); + else { + if (navigator.cookieEnabled) { - //unblock user - if (url.indexOf('?unb:') != -1) { + $rootScope.isLoading = false; - $rootScope.isVisibleLogin = true; - $rootScope.UnblockUser(); - } - else if (url.indexOf('?em:') != -1) { + var url = $location.url(); - $rootScope.isVisibleLogin = false; - $rootScope.isVisibleResetPass = true; - } - else { + //unblock user + if (url.indexOf('?unb:') != -1) { + + $rootScope.isVisibleLogin = true; + $rootScope.UnblockUser(); + } + else if (url.indexOf('?em:') != -1) { + + $rootScope.isVisibleLogin = false; + $rootScope.isVisibleResetPass = true; + } + else { $rootScope.isVisibleLogin = true; $rootScope.isVisibleResetPass = false; @@ -166,7 +166,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A AuthenticateAlreadyLoggedInUser(); } var isRememberChecked = $rootScope.getLocalStorageValue('isRememberMeChecked'); - + if ($rootScope.getLocalStorageValue('isRememberMeChecked') != "" && sessionStorage.getItem("loginSession") == null) { sessionStorage.setItem("loginSession", "true"); } @@ -176,17 +176,18 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A $rootScope.userInfo = { username: $rootScope.getLocalStorageValue('RememberMeLoginId'), password: $rootScope.getLocalStorageValue('RememberMePassword'), rememberChk: true }; }, 800); } + } } - } - - else { - - $rootScope.isVisibleLogin = true; - $rootScope.promptUserForCookies(); + else { + + $rootScope.isVisibleLogin = true; + + $rootScope.promptUserForCookies(); + } + + $rootScope.getConfigurationValues(); } - - $rootScope.getConfigurationValues(); } $rootScope.getConfigurationValues = function () { @@ -397,7 +398,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A $scope.ValidateClientSiteUrl = function () { - urlParams = strIPAddress + "&" + strAccountNumber + "&" + strEdition + "&" + (strSiteReferer != "" && strSiteReferer != null ? strSiteReferer : ""); + // urlParams = strIPAddress + "&" + strAccountNumber + "&" + strEdition + "&" + (strSiteReferer != "" && strSiteReferer != null ? strSiteReferer : ""); var siteInfo = urlParams.split('&'); $rootScope.siteUrlInfo.siteIP = siteInfo[0]; diff --git a/400-SOURCECODE/AIAHTML5.Web/index.aspx b/400-SOURCECODE/AIAHTML5.Web/index.aspx index a4231f0..bf50655 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.aspx +++ b/400-SOURCECODE/AIAHTML5.Web/index.aspx @@ -163,7 +163,10 @@ } - + diff --git a/400-SOURCECODE/AIAHTML5.Web/index.aspx.cs b/400-SOURCECODE/AIAHTML5.Web/index.aspx.cs index 049cb7e..35b8a3f 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.aspx.cs +++ b/400-SOURCECODE/AIAHTML5.Web/index.aspx.cs @@ -17,7 +17,7 @@ namespace ADAM.AIA public string strSiteReferer = ""; public string urlParams = "?"; public string test = ""; - + public bool isCalsCredantial = false; protected void Page_Load(object sender, EventArgs e) { urlParams = "XYZ"; @@ -26,7 +26,12 @@ namespace ADAM.AIA { if (Request.Form["calsCredantial"] != null && Request.Form["calsCredantial"].ToString() == "yes") { - urlParams = "?calsCredantial=" + Request.Form["calsCredantial"].ToString() + "&username=" + Request.Form["calsUsername"].ToString() + "&password=" + Request.Form["calsPassword"].ToString(); + isCalsCredantial = true; + + //urlParams = "?calsCredantial=" + Request.Form["calsCredantial"].ToString() + "&username=" + Request.Form["calsUsername"].ToString() + "&password=" + Request.Form["calsPassword"].ToString(); + //calsCredantialusername&password + urlParams = Request.Form["calsCredantial"].ToString() + "&username=" + Request.Form["calsUsername"].ToString() + "&password=" + Request.Form["calsPassword"].ToString(); + } }