diff --git a/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs b/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs
index 9281a55..b04f4bb 100644
--- a/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs
+++ b/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs
@@ -19,5 +19,7 @@ namespace AIAHTML5.API.Constants
public const string PASSWORD_UPDATE_SUCCESS = "Password updated successfully";
public const string PASSWORD_UPDATE_FAILED = "Password update failed";
+
+ public const string INVALID_USER = "Invalid UserID";
}
}
\ No newline at end of file
diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
index e1a9347..980a25d 100644
--- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
+++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
@@ -40,7 +40,7 @@ namespace AIAHTML5.API.Controllers
else
{
- dynamic authenticationRepsonse = AIAHTML5.API.Models.Users.AuthenticateUser(credentials);
+ dynamic authenticationRepsonse = AIAHTML5.API.Models.Users.GetUserDetailsForAuthenticatedUser(credentials);
if (Convert.ToString(authenticationRepsonse) != AIAConstants.USER_NOT_FOUND && Convert.ToString(authenticationRepsonse) != AIAConstants.ERROR_IN_FECTHING_DETAILS)
{
//string userDetails = Newtonsoft.Json.JsonConvert.SerializeObject(authenticationRepsonse);
diff --git a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
index 503f0db..048d2b4 100644
--- a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
+++ b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
@@ -70,7 +70,7 @@ namespace AIAHTML5.API.Models
return arrUserModules;
}
- public static dynamic GetUserDetailsByLoginIdAndPassword(string sLoginId, string sPassword)
+ public static dynamic GetUserDetailsByLoginIdAndPassword(string loginId, string password)
{
User objUser = new User();
DBModel objModel = new DBModel();
@@ -85,12 +85,12 @@ namespace AIAHTML5.API.Models
cmd.CommandText = "GetUserDetailsByLoginIdAndPassword";
cmd.CommandType = CommandType.StoredProcedure;
- param = new SqlParameter("@sLoginId", sLoginId);
+ param = new SqlParameter("@sLoginId", loginId);
param.Direction = ParameterDirection.Input;
param.DbType = DbType.String;
cmd.Parameters.Add(param);
- param = new SqlParameter("@sPassword", sPassword);
+ param = new SqlParameter("@sPassword", password);
param.Direction = ParameterDirection.Input;
param.DbType = DbType.String;
cmd.Parameters.Add(param);
@@ -155,10 +155,9 @@ namespace AIAHTML5.API.Models
}
}
- if (objUser.IsActive)
+ if (objUser.LoginId != null)
{
-
- if (objUser != null)
+ if (objUser.IsActive)
{
if (objUser.UserType == User.SUPER_ADMIN)
{
@@ -196,14 +195,12 @@ namespace AIAHTML5.API.Models
}
}
}
-
-
else
{
objUser.Modules = null;
- objUser = null;
+ objUser = new User();
+ objUser.License = null;
}
-
}
}
}
@@ -215,7 +212,7 @@ namespace AIAHTML5.API.Models
return objUser;
}
- protected int GetUserLicenseIdByUserId(int iUserId)
+ protected int GetUserLicenseIdByUserId(int userId)
{
int _licenseId = 0;
conn = new SqlConnection(dbConnectionString);
@@ -228,7 +225,7 @@ namespace AIAHTML5.API.Models
cmd.CommandText = "GetLicenseIdByUserId";
cmd.CommandType = CommandType.StoredProcedure;
- param = new SqlParameter("@iUserId", iUserId);
+ param = new SqlParameter("@iUserId", userId);
param.Direction = ParameterDirection.Input;
param.DbType = DbType.Int32;
cmd.Parameters.Add(param);
@@ -240,7 +237,7 @@ namespace AIAHTML5.API.Models
return _licenseId;
}
- protected ArrayList GetModuleStatusByLicenseId(int iLicenseId)
+ protected ArrayList GetModuleStatusByLicenseId(int licenseId)
{
ArrayList userModulelist = new ArrayList();
Hashtable modulesHash;
@@ -255,7 +252,7 @@ namespace AIAHTML5.API.Models
cmd.CommandText = "GetModuleStatusByLicenseId";
cmd.CommandType = CommandType.StoredProcedure;
- param = new SqlParameter("@iLicenseId", iLicenseId);
+ param = new SqlParameter("@iLicenseId", licenseId);
param.Direction = ParameterDirection.Input;
param.DbType = DbType.Int32;
cmd.Parameters.Add(param);
@@ -280,17 +277,17 @@ namespace AIAHTML5.API.Models
{
ArrayList userModules = new ArrayList();
Hashtable moduleHash;
- foreach (Hashtable all in allModules)
+ foreach (Hashtable module in allModules)
{
- string slg = all["slug"].ToString();
- foreach (Hashtable user in modulesByLicense)
+ string slg = module["slug"].ToString();
+ foreach (Hashtable userModule in modulesByLicense)
{
- bool y = Convert.ToBoolean(user["Status"]);
- if ((user["Title"].ToString().Trim() == all["name"].ToString().Trim()) && (Convert.ToBoolean(user["Status"]) == true))
+ bool y = Convert.ToBoolean(userModule["Status"]);
+ if ((userModule["Title"].ToString().Trim() == module["name"].ToString().Trim()) && (Convert.ToBoolean(userModule["Status"]) == true))
{
moduleHash = new Hashtable();
- moduleHash.Add("name", user["Title"]);
- moduleHash.Add("slug", all["slug"]);
+ moduleHash.Add("name", userModule["Title"]);
+ moduleHash.Add("slug", module["slug"]);
userModules.Add(moduleHash);
}
@@ -300,11 +297,11 @@ namespace AIAHTML5.API.Models
return userModules;
}
- protected string GetUserTypeStringById(int iUserTypeId)
+ protected string GetUserTypeStringById(int userTypeId)
{
string userType = string.Empty;
- switch (iUserTypeId)
+ switch (userTypeId)
{
case 1:
userType = User.SUPER_ADMIN;
@@ -337,7 +334,7 @@ namespace AIAHTML5.API.Models
return userType;
}
- public static User GetUserDetailsByEmailId(string sEmailId)
+ public static User GetUserDetailsByEmailId(string emailId)
{
User objUser = new User();
DBModel objModel = new DBModel();
@@ -354,7 +351,7 @@ namespace AIAHTML5.API.Models
cmd.CommandText = "GetUserInfoByEmailId";
cmd.CommandType = CommandType.StoredProcedure;
- param = new SqlParameter("@sEmailId", sEmailId);
+ param = new SqlParameter("@sEmailId", emailId);
param.Direction = ParameterDirection.Input;
param.DbType = DbType.String;
cmd.Parameters.Add(param);
@@ -418,7 +415,7 @@ namespace AIAHTML5.API.Models
return objUser;
}
- public static int UpdateUserPassword(dynamic userInfo, string sLoginId, string sEmailId)
+ public static int UpdateUserPassword(dynamic userInfo, string loginId, string emailId)
{
int result = 0;
conn = new SqlConnection(dbConnectionString);
@@ -427,15 +424,15 @@ namespace AIAHTML5.API.Models
conn.Open();
cmd.CommandText = "UpdateUserPassword";
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.AddWithValue("@sLoginId", sLoginId);
- cmd.Parameters.AddWithValue("@sEmailId", sEmailId);
+ cmd.Parameters.AddWithValue("@sLoginId", loginId);
+ cmd.Parameters.AddWithValue("@sEmailId", emailId);
cmd.Parameters.AddWithValue("@sNewPassword", userInfo["newPassword"].ToString());
result = cmd.ExecuteNonQuery();
conn.Close();
return result;
}
- protected LicenseSubscriptionDetails GetLicenseSubscriptionDetailsByLicenseId(int iLicenseId)
+ protected LicenseSubscriptionDetails GetLicenseSubscriptionDetailsByLicenseId(int licenseId)
{
LicenseSubscriptionDetails lsd = new LicenseSubscriptionDetails();
try
@@ -450,7 +447,7 @@ namespace AIAHTML5.API.Models
cmd.CommandText = "GetSubscriptionDetailsByLicenseId";
cmd.CommandType = CommandType.StoredProcedure;
- param = new SqlParameter("@iLicenseId", iLicenseId);
+ param = new SqlParameter("@iLicenseId", licenseId);
param.Direction = ParameterDirection.Input;
param.DbType = DbType.Int32;
cmd.Parameters.Add(param);
@@ -513,7 +510,7 @@ namespace AIAHTML5.API.Models
return lsd;
}
- protected License GetLicenseDetailsByLicenseId(int iLicenseId)
+ protected License GetLicenseDetailsByLicenseId(int licenseId)
{
License lic = new License();
try
@@ -528,7 +525,7 @@ namespace AIAHTML5.API.Models
cmd.CommandText = "GetLicenseDetailsById";
cmd.CommandType = CommandType.StoredProcedure;
- param = new SqlParameter("@Id", iLicenseId);
+ param = new SqlParameter("@Id", licenseId);
param.Direction = ParameterDirection.Input;
param.DbType = DbType.Int32;
cmd.Parameters.Add(param);
diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs
index dcba8b6..cc9edf5 100644
--- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs
+++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs
@@ -14,7 +14,7 @@ namespace AIAHTML5.API.Models
{
public class Users
{
- internal static dynamic AuthenticateUser(Newtonsoft.Json.Linq.JObject credentials)
+ internal static dynamic GetUserDetailsForAuthenticatedUser(Newtonsoft.Json.Linq.JObject credentials)
{
ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
logger.Debug("inside AuthenticateUser for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString());
@@ -42,13 +42,28 @@ namespace AIAHTML5.API.Models
//{
// return AIAConstants.USER_NOT_FOUND;
//}
- User oUser = DBModel.GetUserDetailsByLoginIdAndPassword(credentials["username"].ToString(), credentials["password"].ToString());
+ User user = DBModel.GetUserDetailsByLoginIdAndPassword(credentials["username"].ToString(), credentials["password"].ToString());
//string userDetails = DBModel.GetUserDetailsByLoginId2(credentials["username"].ToString());
- if (oUser != null)
+ if (user != null)
{
- logger.Debug("userDetails.loginId= " + oUser.LoginId); // .loginId);
- userDetails = JsonConvert.SerializeObject(oUser);
+ logger.Debug("userDetails.loginId= " + user.LoginId); // .loginId);
+
+ if (user.IsActive)
+ {
+ if (user.License != null)
+ {
+ userDetails = JsonConvert.SerializeObject(user);
+ }
+ else
+ {
+ userDetails = AIAConstants.INVALID_USER;
+ }
+ }
+ else
+ {
+ userDetails = AIAConstants.INVALID_USER;
+ }
}
else
{
diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll
index c317899..7d4244c 100644
--- a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll
+++ b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll
diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb
index 0c5cb96..f1ec074 100644
--- a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb
+++ b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb
diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
index 1809fcd..b67aea3 100644
--- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
+++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
@@ -145,34 +145,41 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
$("#messageModal").modal('hide');
}
-
- if ((!result.IsSubscriptionExpired) && (result.UserType == UserTypeConstants.SUPER_ADMIN)) {
- $rootScope.userData = result;
- $rootScope.userModules = result.Modules;
- $rootScope.isVisibleLogin = false;
- $rootScope.haveRoleAdmin = false;
- localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
- $('#dvUserModulesInfo').modal('show');
- }
- else if ((!result.IsSubscriptionExpired) && (result.License.IsActive)) {
-
- $rootScope.userData = result;
- $rootScope.userModules = result.Modules;
- $rootScope.isVisibleLogin = false;
- $rootScope.haveRoleAdmin = true;
- localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
- $('#dvUserModulesInfo').modal('show');
- }
- else if ((result.IsSubscriptionExpired) && (result.License.IsActive)) {
+ if (result == LoginMessageConstants.INVALID_USER) {
$rootScope.isVisibleLogin = true;
- $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.';
+ $rootScope.errorMessage = LoginMessageConstants.INVALID_USER;
$("#messageModal").modal('show');
}
- else if ((result.IsSubscriptionExpired) && !(result.License.IsActive)) {
- $rootScope.isVisibleLogin = true;
- $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.';
- $rootScope.errorMessage = $rootScope.errorMessage + ' '+ LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
- $("#messageModal").modal('show');
+ else {
+
+ if ((!result.IsSubscriptionExpired) && (result.UserType == UserTypeConstants.SUPER_ADMIN)) {
+ $rootScope.userData = result;
+ $rootScope.userModules = result.Modules;
+ $rootScope.isVisibleLogin = false;
+ $rootScope.haveRoleAdmin = false;
+ localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
+ $('#dvUserModulesInfo').modal('show');
+ }
+ else if ((!result.IsSubscriptionExpired) && (result.License.IsActive)) {
+
+ $rootScope.userData = result;
+ $rootScope.userModules = result.Modules;
+ $rootScope.isVisibleLogin = false;
+ $rootScope.haveRoleAdmin = true;
+ localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
+ $('#dvUserModulesInfo').modal('show');
+ }
+ else if ((result.IsSubscriptionExpired) && (result.License.IsActive)) {
+ $rootScope.isVisibleLogin = true;
+ $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.';
+ $("#messageModal").modal('show');
+ }
+ else if ((result.IsSubscriptionExpired) && !(result.License.IsActive)) {
+ $rootScope.isVisibleLogin = true;
+ $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.';
+ $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
+ $("#messageModal").modal('show');
+ }
}
}
diff --git a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
index 47cacd9..4c498a4 100644
--- a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
+++ b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
@@ -324,7 +324,8 @@ AIA.constant("LoginMessageConstants", {
"PASSWORD_UPDATE_SUCCESS": "Password updated successfully",
"PASSWORD_UPDATE_FAILED": "Password update failed",
"SUBSCRIPTION_EXPIRATION_MESSAGE": "Your license has been expired since ",
- "LICENSE_INACTIVE_MESSAGE": "Your license is inactive."
+ "LICENSE_INACTIVE_MESSAGE": "Your license is inactive.",
+ "INVALID_USER": "Invalid UserID"
//"ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.",
//"MAIL_NOT_SENT": "Mail not sent."