Commit 4cc3cfe18825ede70ccb0d8e6f6bce32f455183a
1 parent
0101e483
Committing updated files
Showing
14 changed files
with
344 additions
and
80 deletions
150-DOCUMENTATION/002-DBScripts/sp_GetUserInfoByEmailId.sql
0 → 100644
1 | +-- ================================================ | |
2 | +-- Template generated from Template Explorer using: | |
3 | +-- Create Procedure (New Menu).SQL | |
4 | +-- | |
5 | +-- Use the Specify Values for Template Parameters | |
6 | +-- command (Ctrl-Shift-M) to fill in the parameter | |
7 | +-- values below. | |
8 | +-- | |
9 | +-- This block of comments will not be included in | |
10 | +-- the definition of the procedure. | |
11 | +-- ================================================ | |
12 | +SET ANSI_NULLS ON | |
13 | +GO | |
14 | +SET QUOTED_IDENTIFIER ON | |
15 | +GO | |
16 | +-- ============================================= | |
17 | +-- Author: <Author,,Name> | |
18 | +-- Create date: <Create Date,,> | |
19 | +-- Description: <Description,,> | |
20 | +-- ============================================= | |
21 | +CREATE PROCEDURE GetUserInfoByEmailId | |
22 | + -- Add the parameters for the stored procedure here | |
23 | + @sEmailId VARCHAR(100) | |
24 | +AS | |
25 | +BEGIN | |
26 | + -- SET NOCOUNT ON added to prevent extra result sets from | |
27 | + -- interfering with SELECT statements. | |
28 | + SET NOCOUNT ON; | |
29 | + | |
30 | + -- Insert statements for procedure here | |
31 | + SELECT CreationDate, CreatorId, DeactivationDate, EmailId, FirstName, Id, IsActive, LastName, LoginId, ModifiedDate, ModifierId, Password, SecurityAnswer, SecurityQuestionId, UserTypeId FROM AIAUser WHERE EmailId = @sEmailId | |
32 | +END | |
33 | +GO | |
0 | 34 | \ No newline at end of file | ... | ... |
150-DOCUMENTATION/002-DBScripts/sp_UpdateUserPassord.sql
0 → 100644
1 | +-- ================================================ | |
2 | +-- Template generated from Template Explorer using: | |
3 | +-- Create Procedure (New Menu).SQL | |
4 | +-- | |
5 | +-- Use the Specify Values for Template Parameters | |
6 | +-- command (Ctrl-Shift-M) to fill in the parameter | |
7 | +-- values below. | |
8 | +-- | |
9 | +-- This block of comments will not be included in | |
10 | +-- the definition of the procedure. | |
11 | +-- ================================================ | |
12 | +SET ANSI_NULLS ON | |
13 | +GO | |
14 | +SET QUOTED_IDENTIFIER ON | |
15 | +GO | |
16 | +-- ============================================= | |
17 | +-- Author: <Author,,Name> | |
18 | +-- Create date: <Create Date,,> | |
19 | +-- Description: <Description,,> | |
20 | +-- ============================================= | |
21 | +CREATE PROCEDURE UpdateUserPassword | |
22 | + -- Add the parameters for the stored procedure here | |
23 | + @sLoginId VARCHAR(50), | |
24 | + @sEmailId VARCHAR(100), | |
25 | + @sNewPassword varchar(100) | |
26 | +AS | |
27 | +BEGIN | |
28 | + -- SET NOCOUNT ON added to prevent extra result sets from | |
29 | + -- interfering with SELECT statements. | |
30 | + SET NOCOUNT OFF; | |
31 | + | |
32 | + -- Insert statements for procedure here | |
33 | + UPDATE AIAUser SET Password= @sNewPassword WHERE LoginId= @sLoginId AND EmailId = @sEmailId | |
34 | +END | |
35 | +GO | |
0 | 36 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs
... | ... | @@ -16,5 +16,8 @@ namespace AIAHTML5.API.Constants |
16 | 16 | public const string KEY_TITLE = "title"; |
17 | 17 | public const string KEY_NAME = "name"; |
18 | 18 | public const string KEY_SLUG = "slug"; |
19 | + | |
20 | + public const string PASSWORD_UPDATE_SUCCESS = "Password updated successfully"; | |
21 | + public const string PASSWORD_UPDATE_FAILED = "Password update failed"; | |
19 | 22 | } |
20 | 23 | } |
21 | 24 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs
... | ... | @@ -31,19 +31,57 @@ namespace AIAHTML5.API.Controllers |
31 | 31 | //public void Post([FromBody]string value) |
32 | 32 | //{ |
33 | 33 | //} |
34 | - public HttpResponseMessage Post([FromBody]JObject userInfo) | |
35 | - { | |
36 | - ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
37 | - logger.Debug("inside POST in ForgotUserController for emailId = " + userInfo["emailId"]); | |
34 | + //public HttpResponseMessage Post([FromBody]JObject userInfo) | |
35 | + //{ | |
36 | + // ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
37 | + // logger.Debug("inside POST in ForgotUserController for emailId = " + userInfo["emailId"]); | |
38 | 38 | |
39 | - dynamic userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo); | |
40 | - if (Convert.ToString(userData) != AIAConstants.USER_NOT_FOUND && Convert.ToString(userData) != AIAConstants.ERROR_IN_FECTHING_DETAILS) | |
41 | - { | |
42 | - logger.Debug("inside if in ForgotUserController userData.loginId= " + userData.loginId); | |
43 | - bool isMailSent = false; | |
44 | - string userDetails = Newtonsoft.Json.JsonConvert.SerializeObject(userData); | |
39 | + // dynamic userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo); | |
40 | + // if (Convert.ToString(userData) != AIAConstants.USER_NOT_FOUND && Convert.ToString(userData) != AIAConstants.ERROR_IN_FECTHING_DETAILS) | |
41 | + // { | |
42 | + // //logger.Debug("inside if in ForgotUserController userData.loginId= " + userData.LoginId); | |
43 | + // bool isMailSent = false; | |
44 | + // string userDetails = Newtonsoft.Json.JsonConvert.SerializeObject(userData); | |
45 | 45 | |
46 | - logger.Debug("1. inside if in ForgotUserController userDetails= " + userDetails); | |
46 | + // logger.Debug("1. inside if in ForgotUserController userDetails= " + userDetails); | |
47 | + | |
48 | + // if (Convert.ToBoolean(userInfo["havePassword"])) | |
49 | + // { | |
50 | + // logger.Debug("2. havePassword= " + Convert.ToBoolean(userInfo["havePassword"])); | |
51 | + | |
52 | + // isMailSent = AIAHTML5.API.Models.UserUtility.SendEmail(userData, Convert.ToBoolean(userInfo["havePassword"])); | |
53 | + // } | |
54 | + // else | |
55 | + // { | |
56 | + // logger.Debug("3. havePassword= " + Convert.ToBoolean(userInfo["havePassword"])); | |
57 | + | |
58 | + // isMailSent = AIAHTML5.API.Models.UserUtility.SendEmail(userData, Convert.ToBoolean(userInfo["havePassword"])); | |
59 | + // } | |
60 | + // logger.Debug("isMailSent= " + isMailSent); | |
61 | + // if (isMailSent) | |
62 | + // return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userDetails) }; | |
63 | + // else | |
64 | + // return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MAIL_NOT_SENT)}; | |
65 | + // } | |
66 | + // else | |
67 | + // { | |
68 | + // logger.Debug("inside else in ForgotUserController userData= " + userData); | |
69 | + // return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userData)}; | |
70 | + // } | |
71 | + //} | |
72 | + | |
73 | + public HttpResponseMessage Post([FromBody]JObject userInfo) | |
74 | + { | |
75 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
76 | + logger.Debug("inside POST in ForgotUserController for emailId = " + userInfo["emailId"]); | |
77 | + | |
78 | + User userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo); | |
79 | + if (Convert.ToString(userData) != AIAConstants.USER_NOT_FOUND && Convert.ToString(userData) != AIAConstants.ERROR_IN_FECTHING_DETAILS) | |
80 | + { | |
81 | + //logger.Debug("inside if in ForgotUserController userData.loginId= " + userData.LoginId); | |
82 | + bool isMailSent = false; | |
83 | + | |
84 | + logger.Debug("1. inside if in ForgotUserController userDetails= " + userData.ToString()); | |
47 | 85 | |
48 | 86 | if (Convert.ToBoolean(userInfo["havePassword"])) |
49 | 87 | { |
... | ... | @@ -57,18 +95,17 @@ namespace AIAHTML5.API.Controllers |
57 | 95 | |
58 | 96 | isMailSent = AIAHTML5.API.Models.UserUtility.SendEmail(userData, Convert.ToBoolean(userInfo["havePassword"])); |
59 | 97 | } |
60 | - logger.Debug("isMailSent= " + isMailSent); | |
61 | - if (isMailSent) | |
62 | - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userDetails) }; | |
63 | - else | |
64 | - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MAIL_NOT_SENT)}; | |
65 | - } | |
66 | - else | |
98 | + logger.Debug("isMailSent= " + isMailSent); | |
99 | + if (isMailSent) | |
100 | + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userData.ToString()) }; | |
101 | + else | |
102 | + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MAIL_NOT_SENT) }; | |
103 | + } | |
104 | + else | |
67 | 105 | { |
68 | - logger.Debug("inside else in ForgotUserController userData= " + userData); | |
69 | - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userData)}; //new StringContent(userData) | |
70 | - | |
71 | - } | |
106 | + logger.Debug("inside else in ForgotUserController userData= " + userData); | |
107 | + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userData.ToString()) }; | |
108 | + } | |
72 | 109 | } |
73 | 110 | |
74 | 111 | // PUT api/<controller>/5 | ... | ... |
400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs
... | ... | @@ -35,27 +35,22 @@ namespace AIAHTML5.API.Controllers |
35 | 35 | { |
36 | 36 | ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); |
37 | 37 | logger.Debug("inside POST"); |
38 | - dynamic userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo); | |
38 | + User userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo); | |
39 | + HttpResponseMessage response = null; | |
39 | 40 | if (Convert.ToString(userData) != AIAConstants.USER_NOT_FOUND && Convert.ToString(userData) != AIAConstants.ERROR_IN_FECTHING_DETAILS) |
40 | 41 | { |
41 | - dynamic updatedInfo; | |
42 | - string upInfo; | |
42 | + int result = 0; | |
43 | 43 | if (!String.IsNullOrEmpty(userInfo["newPassword"].ToString())) |
44 | 44 | { |
45 | - updatedInfo = AIAHTML5.API.Models.Users.UpdatePassword(userInfo); | |
46 | - upInfo = Newtonsoft.Json.JsonConvert.SerializeObject(updatedInfo); | |
47 | - if (!string.IsNullOrEmpty(Convert.ToString(updatedInfo))) | |
48 | - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(upInfo) }; | |
45 | + result = AIAHTML5.API.Models.Users.UpdatePassword(userInfo, userData.LoginId, userData.EmailId); | |
46 | + if (result > 0) | |
47 | + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.PASSWORD_UPDATE_SUCCESS) }; | |
49 | 48 | else |
50 | - return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(userData) }; | |
49 | + response = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.PASSWORD_UPDATE_FAILED) }; | |
51 | 50 | } |
52 | - else | |
53 | - return new HttpResponseMessage { StatusCode = HttpStatusCode.BadRequest, Content = new StringContent("Nothing to update") }; | |
54 | - } | |
55 | - else | |
56 | - { | |
57 | - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userData) }; | |
58 | 51 | } |
52 | + | |
53 | + return response; | |
59 | 54 | } |
60 | 55 | |
61 | 56 | // PUT api/<controller>/5 | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... | ... | @@ -150,11 +150,19 @@ namespace AIAHTML5.API.Models |
150 | 150 | if (dc.ColumnName == "CreationDate") |
151 | 151 | objUser.CreationDate = Convert.ToDateTime(dr[dc]); |
152 | 152 | if (dc.ColumnName == "DeactivationDate") |
153 | - objUser.DeactivationDate = Convert.ToDateTime(string.IsNullOrEmpty(dr[dc].ToString()) ? System.Data.SqlTypes.SqlDateTime.MinValue.Value : Convert.ToDateTime(dr[dc].ToString())); //DateTime.TryParse(string.IsNullOrEmpty(dr[dc].ToString())); | |
153 | + { | |
154 | + DateTime? date; | |
155 | + if (dr[dc] == DBNull.Value) | |
156 | + date = null; | |
157 | + else | |
158 | + date = (DateTime)dr[dc]; | |
159 | + | |
160 | + objUser.DeactivationDate = date; | |
161 | + } | |
154 | 162 | if (dc.ColumnName == "ModifierId") |
155 | 163 | objUser.ModifierId = Convert.ToInt32(dr[dc]); |
156 | 164 | if (dc.ColumnName == "ModifiedDate") |
157 | - objUser.FirstName = dr[dc].ToString(); | |
165 | + objUser.ModifiedDate = Convert.ToDateTime(dr[dc]); | |
158 | 166 | if (dc.ColumnName == "UserTypeId") |
159 | 167 | objUser.UserType = objModel.GetUserTypeStringById(Convert.ToInt32(dr[dc])); |
160 | 168 | if (dc.ColumnName == "IsActive") |
... | ... | @@ -324,5 +332,103 @@ namespace AIAHTML5.API.Models |
324 | 332 | } |
325 | 333 | return userType; |
326 | 334 | } |
335 | + | |
336 | + public static User GetUserDetailsByEmailId(string sEmailId) | |
337 | + { | |
338 | + User objUser = new User(); | |
339 | + DBModel objModel = new DBModel(); | |
340 | + | |
341 | + try | |
342 | + { | |
343 | + conn = new SqlConnection(dbConnectionString); | |
344 | + cmd = new SqlCommand(); | |
345 | + SqlDataAdapter adapter; | |
346 | + SqlParameter param; | |
347 | + DataSet ds = new DataSet(); | |
348 | + | |
349 | + cmd.Connection = conn; | |
350 | + cmd.CommandText = "GetUserInfoByEmailId"; | |
351 | + cmd.CommandType = CommandType.StoredProcedure; | |
352 | + | |
353 | + param = new SqlParameter("@sEmailId", sEmailId); | |
354 | + param.Direction = ParameterDirection.Input; | |
355 | + param.DbType = DbType.String; | |
356 | + cmd.Parameters.Add(param); | |
357 | + | |
358 | + adapter = new SqlDataAdapter(cmd); | |
359 | + adapter.Fill(ds); | |
360 | + DataTable dt = ds.Tables[0]; | |
361 | + | |
362 | + foreach (DataRow dr in dt.Rows) | |
363 | + { | |
364 | + foreach (DataColumn dc in dt.Columns) | |
365 | + { | |
366 | + if (dc.ColumnName == "Id") | |
367 | + objUser.Id = Convert.ToInt32(dr[dc]); | |
368 | + if (dc.ColumnName == "FirstName") | |
369 | + objUser.FirstName = dr[dc].ToString(); | |
370 | + if (dc.ColumnName == "LastName") | |
371 | + objUser.LastName = dr[dc].ToString(); | |
372 | + if (dc.ColumnName == "EmailId") | |
373 | + objUser.EmailId = dr[dc].ToString(); | |
374 | + if (dc.ColumnName == "LoginId") | |
375 | + objUser.LoginId = dr[dc].ToString(); | |
376 | + if (dc.ColumnName == "Password") | |
377 | + objUser.Password = dr[dc].ToString(); | |
378 | + if (dc.ColumnName == "SecurityQuestionId") | |
379 | + { | |
380 | + int tempVal; | |
381 | + objUser.SecurityQuestionId = Int32.TryParse(dr[dc].ToString(), out tempVal) ? tempVal : (int?)null; | |
382 | + } | |
383 | + if (dc.ColumnName == "SecurityAnswer") | |
384 | + objUser.SecurityAnswer = dr[dc].ToString(); | |
385 | + if (dc.ColumnName == "CreatorId") | |
386 | + objUser.CreatorId = Convert.ToInt32(dr[dc]); | |
387 | + if (dc.ColumnName == "CreationDate") | |
388 | + objUser.CreationDate = Convert.ToDateTime(dr[dc]); | |
389 | + if (dc.ColumnName == "DeactivationDate") | |
390 | + { | |
391 | + DateTime? date; | |
392 | + if(dr[dc] == DBNull.Value) | |
393 | + date = null; | |
394 | + else | |
395 | + date = (DateTime)dr[dc]; | |
396 | + | |
397 | + objUser.DeactivationDate = date; | |
398 | + } | |
399 | + if (dc.ColumnName == "ModifierId") | |
400 | + objUser.ModifierId = Convert.ToInt32(dr[dc]); | |
401 | + if (dc.ColumnName == "ModifiedDate") | |
402 | + objUser.ModifiedDate = Convert.ToDateTime(dr[dc]); | |
403 | + if (dc.ColumnName == "UserTypeId") | |
404 | + objUser.UserType = objModel.GetUserTypeStringById(Convert.ToInt32(dr[dc])); | |
405 | + if (dc.ColumnName == "IsActive") | |
406 | + objUser.IsActive = Convert.ToBoolean(dr[dc]); | |
407 | + | |
408 | + } | |
409 | + } | |
410 | + } | |
411 | + catch (Exception ex) | |
412 | + { } | |
413 | + | |
414 | + return objUser; | |
415 | + } | |
416 | + | |
417 | + public static int UpdateUserPassword(dynamic userInfo, string sLoginId, string sEmailId) | |
418 | + { | |
419 | + int result = 0; | |
420 | + conn = new SqlConnection(dbConnectionString); | |
421 | + cmd = new SqlCommand(); | |
422 | + cmd.Connection = conn; | |
423 | + conn.Open(); | |
424 | + cmd.CommandText = "UpdateUserPassword"; | |
425 | + cmd.CommandType = CommandType.StoredProcedure; | |
426 | + cmd.Parameters.AddWithValue("@sLoginId", sLoginId); | |
427 | + cmd.Parameters.AddWithValue("@sEmailId", sEmailId); | |
428 | + cmd.Parameters.AddWithValue("@sNewPassword", userInfo["newPassword"].ToString()); | |
429 | + result = cmd.ExecuteNonQuery(); | |
430 | + conn.Close(); | |
431 | + return result; | |
432 | + } | |
327 | 433 | } |
328 | 434 | } |
329 | 435 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/User.cs
... | ... | @@ -18,7 +18,7 @@ namespace AIAHTML5.API.Models |
18 | 18 | public string SecurityAnswer { get; set; } |
19 | 19 | public int CreatorId { get; set; } |
20 | 20 | public DateTime CreationDate { get; set; } |
21 | - public DateTime DeactivationDate { get; set; } | |
21 | + public DateTime? DeactivationDate { get; set; } | |
22 | 22 | public int ModifierId { get; set; } |
23 | 23 | public DateTime ModifiedDate { get; set; } |
24 | 24 | public string UserType { get; set; } | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/UserUtility.cs
... | ... | @@ -38,20 +38,29 @@ namespace AIAHTML5.API.Models |
38 | 38 | string lName = string.Empty; |
39 | 39 | string site_url = Convert.ToString(ConfigurationManager.AppSettings["Site_URL"]); |
40 | 40 | |
41 | - foreach (KeyValuePair<string, object> userObj in UserDetails) | |
42 | - { | |
43 | - if (userObj.Key == "loginId") | |
44 | - userId = userObj.Value.ToString(); | |
45 | - | |
46 | - if (userObj.Key == "emailId") | |
47 | - userMail = userObj.Value.ToString(); | |
48 | - | |
49 | - if (userObj.Key == "firstName") | |
50 | - fName = userObj.Value.ToString(); | |
51 | - | |
52 | - if (userObj.Key == "lastName") | |
53 | - lName = userObj.Value.ToString(); | |
54 | - } | |
41 | + //foreach (KeyValuePair<string, object> userObj in UserDetails) | |
42 | + //{ | |
43 | + // if (userObj.Key == "LoginId") | |
44 | + // userId = userObj.Value.ToString(); | |
45 | + | |
46 | + // if (userObj.Key == "EmailId") | |
47 | + // userMail = userObj.Value.ToString(); | |
48 | + | |
49 | + // if (userObj.Key == "FirstName") | |
50 | + // fName = userObj.Value.ToString(); | |
51 | + | |
52 | + // if (userObj.Key == "LastName") | |
53 | + // lName = userObj.Value.ToString(); | |
54 | + //} | |
55 | + | |
56 | + if (UserDetails.LoginId != "") | |
57 | + userId = UserDetails.LoginId.ToString(); | |
58 | + if (UserDetails.EmailId != "") | |
59 | + userMail = UserDetails.EmailId.ToString(); | |
60 | + if (UserDetails.FirstName != "") | |
61 | + fName = UserDetails.FirstName.ToString(); | |
62 | + if(UserDetails.LastName!="") | |
63 | + lName = UserDetails.LastName.ToString(); | |
55 | 64 | |
56 | 65 | string fullName = fName + " " + lName; |
57 | 66 | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... | ... | @@ -71,49 +71,78 @@ namespace AIAHTML5.API.Models |
71 | 71 | { |
72 | 72 | ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); |
73 | 73 | logger.Debug(" inside GetUserByEmail for emailId = " + userInfo["emailId"] ); |
74 | - var client = new MongoClient(); | |
74 | + //var client = new MongoClient(); | |
75 | 75 | |
76 | - try | |
77 | - { | |
76 | + //try | |
77 | + //{ | |
78 | 78 | |
79 | - var db = client.GetDatabase(Settings.Default.database); | |
79 | + // var db = client.GetDatabase(Settings.Default.database); | |
80 | 80 | |
81 | - var collection = db.GetCollection<dynamic>("Users"); | |
81 | + // var collection = db.GetCollection<dynamic>("Users"); | |
82 | 82 | |
83 | - FilterDefinition<dynamic> filterCondition = Builders<dynamic>.Filter.Eq("emailId", userInfo["emailId"].ToString().ToLower()); | |
83 | + // FilterDefinition<dynamic> filterCondition = Builders<dynamic>.Filter.Eq("emailId", userInfo["emailId"].ToString().ToLower()); | |
84 | 84 | |
85 | - dynamic userDetails = collection.Find(Builders<dynamic>.Filter.And(filterCondition)).SingleOrDefault(); | |
86 | - if (userDetails != null) | |
87 | - { | |
88 | - logger.Debug("userDetails= " + userDetails.loginId); | |
85 | + // dynamic userDetails = collection.Find(Builders<dynamic>.Filter.And(filterCondition)).SingleOrDefault(); | |
86 | + // if (userDetails != null) | |
87 | + // { | |
88 | + // logger.Debug("userDetails= " + userDetails.loginId); | |
89 | 89 | |
90 | - return userDetails; | |
90 | + // return userDetails; | |
91 | + // } | |
92 | + // else | |
93 | + // { | |
94 | + // logger.Debug("user not found"); | |
95 | + // return AIAConstants.USER_NOT_FOUND; | |
96 | + // } | |
97 | + //} | |
98 | + //catch (Exception e) | |
99 | + //{ | |
100 | + // logger.Fatal("Exception= " + e.Message+", stacktrace = "+e.StackTrace); | |
101 | + // return AIAConstants.ERROR_IN_FECTHING_DETAILS; | |
102 | + //} | |
103 | + | |
104 | + try | |
105 | + { | |
106 | + User objUser = DBModel.GetUserDetailsByEmailId(userInfo["emailId"].ToString()); | |
107 | + | |
108 | + //dynamic userDetails; | |
109 | + | |
110 | + if (objUser != null) | |
111 | + { | |
112 | + logger.Debug("userDetails.loginId= " + objUser.LoginId); | |
113 | + //return userDetails = JsonConvert.SerializeObject(objUser); | |
114 | + return objUser; | |
91 | 115 | } |
92 | 116 | else |
93 | 117 | { |
94 | - logger.Debug("user not found"); | |
95 | 118 | return AIAConstants.USER_NOT_FOUND; |
96 | 119 | } |
97 | 120 | } |
98 | - catch (Exception e) | |
121 | + catch (Exception ex) | |
99 | 122 | { |
100 | - logger.Fatal("Exception= " + e.Message+", stacktrace = "+e.StackTrace); | |
101 | - return AIAConstants.ERROR_IN_FECTHING_DETAILS; | |
123 | + logger.Fatal("Exception in Gettting UserDetailsByEmailId for EmailId =" + userInfo["emailId"].ToString() + " Exception= " + ex.Message); | |
124 | + | |
125 | + string errorMessage = AIAConstants.ERROR_IN_FECTHING_DETAILS; | |
126 | + return errorMessage; | |
102 | 127 | } |
128 | + | |
129 | + | |
103 | 130 | } |
104 | 131 | |
105 | - internal static dynamic UpdatePassword(Newtonsoft.Json.Linq.JObject userInfo) | |
132 | + internal static dynamic UpdatePassword(Newtonsoft.Json.Linq.JObject userInfo, string sLoginId, string sEmailId) | |
106 | 133 | { |
107 | 134 | ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); |
108 | - var client = new MongoClient(); | |
135 | + //var client = new MongoClient(); | |
109 | 136 | try |
110 | 137 | { |
111 | - var db = client.GetDatabase(Settings.Default.database); | |
112 | - var collection = db.GetCollection<BsonDocument>("Users"); | |
113 | - var filter = Builders<BsonDocument>.Filter.Eq("emailId", userInfo["emailId"].ToString()); | |
114 | - var update = Builders<BsonDocument>.Update.Set("password", userInfo["newPassword"].ToString()).CurrentDate("modifiedDate"); | |
138 | + //var db = client.GetDatabase(Settings.Default.database); | |
139 | + //var collection = db.GetCollection<BsonDocument>("Users"); | |
140 | + //var filter = Builders<BsonDocument>.Filter.Eq("emailId", userInfo["emailId"].ToString()); | |
141 | + //var update = Builders<BsonDocument>.Update.Set("password", userInfo["newPassword"].ToString()).CurrentDate("modifiedDate"); | |
115 | 142 | |
116 | - var result = collection.UpdateOne(filter, update); | |
143 | + //var result = collection.UpdateOne(filter, update); | |
144 | + | |
145 | + int result = DBModel.UpdateUserPassword(userInfo, sLoginId, sEmailId); | |
117 | 146 | |
118 | 147 | if (result != null) |
119 | 148 | return result; | ... | ... |
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll
No preview for this file type
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config
... | ... | @@ -30,19 +30,33 @@ |
30 | 30 | </root> |
31 | 31 | </log4net> |
32 | 32 | |
33 | - <appSettings> | |
33 | + <!--<appSettings> | |
34 | 34 | <add key="SenderEmailAddress" value="support@interactiveanatomy.com" /> |
35 | 35 | <add key="ErrorNotificationEmailAddress" value="support@interactiveanatomy.com" /> |
36 | 36 | <add key="SenderPassword" value="" /> |
37 | - <add key="SMTPAddress" value="10.100.12.13" /> | |
38 | - <add key="SMTPPort" value="25" /> | |
37 | + <add key="SMTPAddress" value="10.100.12.13" /> smtp.emailsrvr.com | |
38 | + <add key="SMTPPort" value="25" /> 587 | |
39 | 39 | <add key="EnableSSL" value="false" /> |
40 | 40 | <add key="Site_Url" value ="http://qa.beta.interactiveanatomy.com/"/> |
41 | 41 | <add key ="HostAddress" value="10.100.12.13" /> |
42 | 42 | <add key="isUserAuthenticated" value="false"/> |
43 | 43 | <add key="AdminSupport" value="amrita.vishnoi@ebix.com,nikita.kulshreshtha@ebix.com"/> |
44 | 44 | <add key ="AIADatabaseV5Context" value="Data Source=192.168.90.53;Initial Catalog=AIADatabaseV5;User ID=AIA_Dev;Password=india123;"/> |
45 | - </appSettings> | |
45 | + </appSettings>--> | |
46 | + | |
47 | + <appSettings> | |
48 | + <add key="SenderEmailAddress" value="utkarsh.singh@ebix.com" /> | |
49 | + <add key="ErrorNotificationEmailAddress" value="support@interactiveanatomy.com" /> | |
50 | + <add key="SenderPassword" value="utkarsh@3bix" /> | |
51 | + <add key="SMTPAddress" value="smtp.emailsrvr.com" /> | |
52 | + <add key="SMTPPort" value="587" /> | |
53 | + <add key="EnableSSL" value="false" /> | |
54 | + <add key="Site_Url" value ="//192.168.83.135:82/AIA"/> | |
55 | + <add key ="HostAddress" value="10.100.12.13" /> | |
56 | + <add key="isUserAuthenticated" value="false"/> | |
57 | + <add key="AdminSupport" value="amrita.vishnoi@ebix.com,nikita.kulshreshtha@ebix.com"/> | |
58 | + <add key ="AIADatabaseV5Context" value="Data Source=192.168.90.53;Initial Catalog=AIADatabaseV5;User ID=AIA_Dev;Password=india123;"/> | |
59 | + </appSettings> | |
46 | 60 | <system.web> |
47 | 61 | <compilation debug="true" targetFramework="4.5" /> |
48 | 62 | <httpRuntime targetFramework="4.5" /> | ... | ... |
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb
No preview for this file type
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... | ... | @@ -309,7 +309,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic |
309 | 309 | |
310 | 310 | } |
311 | 311 | else { |
312 | - if ((result.IsAcknowledged == true) && (result.IsModifiedCountAvailable == true)) { | |
312 | + //if ((result.IsAcknowledged == true) && (result.IsModifiedCountAvailable == true)) { | |
313 | + if (result == LoginMessageConstants.PASSWORD_UPDATE_SUCCESS) { | |
313 | 314 | // alert(LoginMessageConstants.PASSWORD_RESET_MESSAGE); |
314 | 315 | $rootScope.errorMassage = LoginMessageConstants.PASSWORD_RESET_MESSAGE; |
315 | 316 | $("#messageModal").modal('show'); | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
... | ... | @@ -306,6 +306,8 @@ AIA.constant("LoginMessageConstants", { |
306 | 306 | "NEW_AND_OLD_PASSWORD_DONOT_MATCH": "Your new password and confirm password not matched!", |
307 | 307 | "USER_CREDENTIALS_MISSING": "Please Enter your credentials.", |
308 | 308 | "USER_NOT_FOUND": "User not found.", |
309 | + "PASSWORD_UPDATE_SUCCESS": "Password updated successfully", | |
310 | + "PASSWORD_UPDATE_FAILED": "Password update failed" | |
309 | 311 | //"ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.", |
310 | 312 | //"MAIL_NOT_SENT": "Mail not sent." |
311 | 313 | ... | ... |