diff --git a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj index 94851ca..e47bbf3 100644 --- a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj +++ b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj @@ -96,6 +96,8 @@ + + Designer @@ -104,9 +106,12 @@ + + Global.asax + @@ -114,6 +119,7 @@ True Settings.settings + diff --git a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj.user b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj.user index cd4414e..13dd77d 100644 --- a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj.user +++ b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj.user @@ -6,6 +6,7 @@ True False + ShowAllFiles diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs new file mode 100644 index 0000000..49fa7a7 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using AIAHTML5.API.Constants; +using log4net; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using AIAHTML5.API.Models; +using AIAHTML5.API.Utility; + +namespace AIAHTML5.API.Controllers +{ + public class ForgotUserController : ApiController + { + // GET api/ + public IEnumerable Get() + { + return new string[] { "value1", "value2" }; + } + + // GET api//5 + public string Get(int id) + { + return "value"; + } + + // POST api/ + //public void Post([FromBody]string value) + //{ + //} + public HttpResponseMessage Post([FromBody]JObject userInfo) + { + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); + logger.Debug("inside POST"); + //UserInfo userData = new UserInfo(); + //dynamic userData = AIAHTML5.API.Models.Users.GetUserByEmail(userEmail); + //dynamic userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo); + //userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo); + dynamic userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo); + if (Convert.ToString(userData) != AIAConstants.USER_NOT_FOUND && Convert.ToString(userData) != AIAConstants.ERROR_IN_FECTHING_DETAILS) + { + bool res = false; + string userDetails = Newtonsoft.Json.JsonConvert.SerializeObject(userData); + if (Convert.ToBoolean(userInfo["isPassword"])) + res = AIAHTML5.API.Models.ResetUser.SendEmail(userData, true); + else + res = AIAHTML5.API.Models.ResetUser.SendEmail(userData, false); + + if (res) + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userDetails) }; + else + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(userData) }; + } + else + { + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userData) }; //new StringContent(userData) + + } + } + + + //public HttpResponseMessage Post([FromBody]JObject userInfo) + //{ + // ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); + // logger.Debug("inside POST"); + // //UserInfo userData = new UserInfo(); + // //dynamic userData = AIAHTML5.API.Models.Users.GetUserByEmail(userEmail); + // //dynamic userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo); + // //userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo); + // dynamic userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo); + // if (Convert.ToString(userData) != AIAConstants.USER_NOT_FOUND && Convert.ToString(userData) != AIAConstants.ERROR_IN_FECTHING_DETAILS) + // { + // bool res = false; + // string userDetails = Newtonsoft.Json.JsonConvert.SerializeObject(userData); + // if (Convert.ToBoolean(userInfo["isPassword"])) + // res = AIAHTML5.API.Models.ResetUser.SendEmail(userData, true); + // else + // res = AIAHTML5.API.Models.ResetUser.SendEmail(userData, false); + + // if (res) + // return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userDetails) }; + // else + // return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(userData) }; + // } + // else + // { + // return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userData) }; //new StringContent(userData) + + // } + //} + // PUT api//5 + public void Put(int id, [FromBody]string value) + { + } + + // DELETE api//5 + public void Delete(int id) + { + } + } +} \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs new file mode 100644 index 0000000..623880f --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using AIAHTML5.API.Constants; +using log4net; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using AIAHTML5.API.Models; +using AIAHTML5.API.Utility; + +namespace AIAHTML5.API.Controllers +{ + public class ResetPasswordController : ApiController + { + // GET api/ + public IEnumerable Get() + { + return new string[] { "value1", "value2" }; + } + + // GET api//5 + public string Get(int id) + { + return "value"; + } + + // POST api/ + //public void Post([FromBody]string value) + //{ + //} + public HttpResponseMessage Post([FromBody]JObject userInfo) + { + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); + logger.Debug("inside POST"); + dynamic userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo); + if (Convert.ToString(userData) != AIAConstants.USER_NOT_FOUND && Convert.ToString(userData) != AIAConstants.ERROR_IN_FECTHING_DETAILS) + { + dynamic updatedInfo = AIAHTML5.API.Models.Users.UpdatePassword(userInfo); + string upInfo = Newtonsoft.Json.JsonConvert.SerializeObject(updatedInfo); + if(!string.IsNullOrEmpty(Convert.ToString(updatedInfo))) + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(upInfo) }; + else + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(userData) }; + } + else + { + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userData) }; //new StringContent(userData) + + } + } + + // PUT api//5 + public void Put(int id, [FromBody]string value) + { + } + + // DELETE api//5 + public void Delete(int id) + { + } + } +} \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Models/ResetUser.cs b/400-SOURCECODE/AIAHTML5.API/Models/ResetUser.cs new file mode 100644 index 0000000..6983135 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/Models/ResetUser.cs @@ -0,0 +1,184 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using MongoDB.Driver; +using MongoDB.Bson; +using AIAHTML5.API.Properties; +using AIAHTML5.API.Constants; +using log4net; +using System.Net.Mail; +using AIAHTML5.API.Utility; +using System.Text; +using System.IO; +using System.Net.Mime; + +namespace AIAHTML5.API.Models +{ + public class ResetUser + { + public static bool SendEmail(dynamic UserDetails, bool isPassword) + { + try + { + List lstLinkedResource = new List(); + EmailUtility sEmailUtility = new EmailUtility(); + List lstToAddress = new List(); + List lstBccAddress = new List(); + LinkedResource LinkImage; + string ParseText = ""; + int TextPos = 0; + int MinPos = 0; + string ImgSrc = ""; + int Counter = 0; + string sEmailText = string.Empty; + string _userId = string.Empty; + string _password = string.Empty; + string _userMail = string.Empty; + string _userName = string.Empty; + string _fName = string.Empty; + string _lName = string.Empty; + + foreach (KeyValuePair kvp in UserDetails) + { + if (kvp.Key == "loginId") + _userId = kvp.Value.ToString(); + + if (kvp.Key == "password") + _password = kvp.Value.ToString(); + + if (kvp.Key == "emailId") + _userMail = kvp.Value.ToString(); + + if (kvp.Key == "firstName") + _fName = kvp.Value.ToString(); + + if (kvp.Key == "lastName") + _lName = kvp.Value.ToString(); + } + + string _fullName = _fName + " " + _lName; + + ImgSrc = "//52.2.38.120/content/images/common/logo-large.png"; + ImgSrc = "//192.168.86.34:82/content/images/common/logo-large.png"; + string _logoPath = HttpContext.Current.Server.MapPath("//52.2.38.120/content/images/common/logo-large.png"); + + string _templatePath = string.Empty; + + if (!isPassword) + _templatePath = "~/Templates/forgot-UserId.html"; + else + _templatePath = "~/Templates/forgot-Password.html"; + + string _resetPassLink = "//192.168.86.34:82?e:"+ HttpUtility.UrlEncode(_userMail); + + + + string mailBody = ResetUser.ReadMailBodyTextFromFile(_templatePath, _userId, _password, _userMail, _fullName, _resetPassLink); + //sBody.Append("
AIA
Forgot UserID
 
Hello {userName}
 
You have requested your 'Login ID' for following account: {emailId}
 
Your login ID is: {loginId}
 
 
 
A.D.A.M. – the company that pioneered online health content – is dedicated to creating and offering the most effective and innovative educational solutions possible for teaching medical science and improving health literacy.
 
Give us a call toll-free at 1-888-278-9614 or send us an email if you have any questions or if you need help. It will be our pleasure to help you.
 
 
© 2017 Ebix, Inc. All Rights Reserved.
"); + + lstToAddress.Add(_userMail); + + sEmailText = mailBody; + + // for embedding images in email + if (sEmailText.Contains(""; + AlternateView alternateView = AlternateView.CreateAlternateViewFromString(htmlBody, null, MediaTypeNames.Text.Html); + alternateView.LinkedResources.Add(inline); + return alternateView; + } + } +} \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs index e7b2508..b575955 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs @@ -12,7 +12,7 @@ namespace AIAHTML5.API.Models { public class Users { - + internal static dynamic AuthenticateUser(Newtonsoft.Json.Linq.JObject credentials) { @@ -29,9 +29,9 @@ namespace AIAHTML5.API.Models Builders.Filter.Eq("password", credentials["password"].ToString())}; dynamic userDetails = collection.Find(Builders.Filter.And(filterCondition)).SingleOrDefault(); - - - if (userDetails!= null) + + + if (userDetails != null) { logger.Debug("userDetails.loginId= " + userDetails.loginId); return userDetails; @@ -41,15 +41,81 @@ namespace AIAHTML5.API.Models return AIAConstants.USER_NOT_FOUND; } } - catch(Exception e) + catch (Exception e) { - + logger.Fatal("Exception in AuthenticateUser for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message); - + string errorMessage = AIAConstants.ERROR_IN_FECTHING_DETAILS; return errorMessage; } } + + internal static dynamic GetUserByEmail(Newtonsoft.Json.Linq.JObject userInfo) + { + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); + var client = new MongoClient(); + + try + { + + var db = client.GetDatabase(Settings.Default.database); + + var collection = db.GetCollection("Users"); + + FilterDefinition filterCondition = Builders.Filter.Eq("emailId", userInfo["emailId"].ToString().ToLower()); + + dynamic userDetails = collection.Find(Builders.Filter.And(filterCondition)).SingleOrDefault(); + + if (userDetails != null) + return userDetails; + else + return AIAConstants.USER_NOT_FOUND; + } + catch (Exception e) + { + logger.Fatal("Exception= " + e.Message); + return AIAConstants.ERROR_IN_FECTHING_DETAILS; + } + } + + internal static dynamic UpdatePassword(Newtonsoft.Json.Linq.JObject userInfo) + { + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); + var client = new MongoClient(); + try + { + //var db = client.GetDatabase(Settings.Default.database); + + //var collection = db.GetCollection("Users"); + + //FilterDefinition filterCondition = Builders.Filter.Eq("emailId", userInfo["emailId"].ToString().ToLower()); + + //dynamic userDetails = collection.Find(Builders.Update.Set("password", userInfo["newpass"].ToString())); + + //if (userDetails != null) + // return userDetails; + //else + // return AIAConstants.USER_NOT_FOUND; + + var db = client.GetDatabase(Settings.Default.database); + //var collection = db.GetCollection("Users"); + var collection = db.GetCollection("Users"); + var filter = Builders.Filter.Eq("emailId", userInfo["emailId"].ToString()); + var update = Builders.Update.Set("password", userInfo["newpass"].ToString()).CurrentDate("modifiedDate"); + var result = collection.UpdateOne(filter, update); + + if (result != null) + return result; + else + return AIAConstants.USER_NOT_FOUND; + } + catch (Exception e) + { + logger.Fatal("Exception= " + e.Message); + return AIAConstants.ERROR_IN_FECTHING_DETAILS; + } + } } } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Templates/Forgot-UserId.html b/400-SOURCECODE/AIAHTML5.API/Templates/Forgot-UserId.html new file mode 100644 index 0000000..33441a3 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/Templates/Forgot-UserId.html @@ -0,0 +1,67 @@ + + + + + + + + + + + + + +
+ AIA +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Forgot UserID
 
Hello {userFullName}
 
You have requested your 'Login ID' for following account: {emailId}
 
Your login ID is: {loginId}
 
 
 
+
+ + + + + + + + + + + + +
A.D.A.M. – the company that pioneered online health content – is dedicated to creating and offering the most effective and innovative educational solutions possible for teaching medical science and improving health literacy.
 
Give us a call toll-free at 1-888-278-9614 or send us an email if you have any questions or if you need help. It will be our pleasure to help you.
 
 
© 2017 Ebix, Inc. All Rights Reserved.
+
\ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Templates/forgot-Password.html b/400-SOURCECODE/AIAHTML5.API/Templates/forgot-Password.html new file mode 100644 index 0000000..29aaf91 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/Templates/forgot-Password.html @@ -0,0 +1,79 @@ + + + + + + + + + + + + + +
+ AIA +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Forgot Password
 
Hi,
 
You have requested password reset for your account: {emailId}
 
You can reset your password by clicking the link below:
{resetPasswordLink}
 
If you have not requested for password reset, please ignore this mail.
 
 
 
+
+ + + + + + + + + + + + +
A.D.A.M. – the company that pioneered online health content – is dedicated to creating and offering the most effective and innovative educational solutions possible for teaching medical science and improving health literacy.
 
Give us a call toll-free at 1-888-278-9614 or send us an email if you have any questions or if you need help. It will be our pleasure to help you.
 
 
© 2017 Ebix, Inc. All Rights Reserved.
+
\ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs b/400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs new file mode 100644 index 0000000..9d5ecac --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs @@ -0,0 +1,268 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Configuration; +using System.Collections; +using System.Xml; +using System.Text; +using System.IO; +using System.Net.Mail; + +namespace AIAHTML5.API.Utility +{ + + public class EmailUtility + { + public string sFromAddress { get; set; } + public List sToAddresses { get; set; } + public List sBccAddresses { get; set; } + public string sHostName { get; set; } + public string sSubject { get; set; } + public int iPort { get; set; } + public bool bEnableSsl { get; set; } + public string sUserName { get; set; } + public string sPassword { get; set; } + public bool bIsBodyHtml { get; set; } + public List sAttachments { get; set; } + public string sBodyText { get; set; } + public AlternateView sAlternateView { get; set; } + + public void SendMail(MailMessage mm) + { + SmtpClient smtp = new SmtpClient(); + smtp.Host = ConfigurationManager.AppSettings["SMTPAddress"]; + smtp.EnableSsl = Convert.ToBoolean(ConfigurationManager.AppSettings["EnableSSL"]); + System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential(mm.From.ToString(), ConfigurationManager.AppSettings["SenderPassword"]); + smtp.Credentials = NetworkCred; + smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]); + /*string ccAddress = ConfigurationManager.AppSettings["NotifyCopyAddress"]; + string[] emailArr = ccAddress.Split(','); + if (mm.From.ToString().Equals("pfizerhelp@ebix.com")) + { + ccAddress = emailArr[0]; + if (!ccAddress.Equals("")) + { + mm.Bcc.Add(ccAddress); + } + } + else + { + if (!ccAddress.Equals("")) + { + mm.Bcc.Add(ccAddress); + } + }*/ + + + smtp.Send(mm); + } + + public void SendSmtpEmail() + { + try + { + MailMessage sMail = new MailMessage(); + SmtpClient SmtpServer = new SmtpClient(sHostName); + string recipientEmailAddress = string.Empty; + + + if (sToAddresses != null) + { + foreach (var sItem in sToAddresses) + { + sMail.To.Add(sItem); + + } + } + + if (sBccAddresses != null) + { + foreach (var sItem in sBccAddresses) + { + sMail.Bcc.Add(sItem); + } + } + + sMail.IsBodyHtml = bIsBodyHtml; + + if (sAlternateView != null) + { + sMail.AlternateViews.Add(sAlternateView); + } + else + { + sMail.Body = sBodyText; + } + + sMail.Subject = sSubject; + if (sAttachments != null) + { + foreach (var sItem in sAttachments) + { + sMail.Attachments.Add(sItem); + } + } + + SmtpServer.Port = iPort; + SmtpServer.Credentials = new System.Net.NetworkCredential(sUserName, sPassword); + SmtpServer.EnableSsl = bEnableSsl; + + // SmtpServer.Send(sMail); + using (MailMessage mm = new MailMessage(sFromAddress, sMail.To.ToString())) + //using (MailMessage mm = new MailMessage()) + { + mm.Subject = sSubject; + mm.IsBodyHtml = bIsBodyHtml; + // mm.To.Add(sMail.To.ToString()); + //mm.From = new MailAddress(sFromAddress, "AdamOnDemand"); + if (sAlternateView != null) + { + mm.AlternateViews.Add(sAlternateView); + } + else + { + mm.Body = sBodyText; + } + // mm.Body = sAlternateView; + // string bccAddress = (!string.IsNullOrEmpty(sBccAddresses) ? lstBccAddress : ConfigurationManager.AppSettings["AccountsEmailAddress"]); + /* if (sBccAddresses != null) + { + foreach (var sItem in sBccAddresses) + { + mm.Bcc.Add(sItem); + } + }*/ + //else + //{ + // string bccAddress = ConfigurationManager.AppSettings["AccountsEmailAddress"]; + // mm.Bcc.Add(bccAddress); + //} + mm.IsBodyHtml = true; + SendMail(mm); + } + + } + catch (Exception ex) + { + throw ex; + } + } + + + //public static bool SendEmail(dynamic UserDetails, bool isPassword) + //{ + // try + // { + // List lstLinkedResource = new List(); + // EmailUtility sEmailUtility = new EmailUtility(); + // List lstToAddress = new List(); + // List lstBccAddress = new List(); + // LinkedResource LinkImage; + // string AdminNames = ""; + // string sEmailText = ""; + // string ParseText = ""; + // int TextPos = 0; + // int MinPos = 0; + // string ImgSrc = ""; + // int Counter = 0; + + // string _userId = string.Empty; + // string _password = string.Empty; + // string _userMail = string.Empty; + + // foreach (KeyValuePair kvp in UserDetails) + // { + // if(kvp.Key == "loginId") + // _userId = kvp.Value.ToString(); + + // if(kvp.Key == "password") + // _password = kvp.Value.ToString(); + + // if(kvp.Key == "emailId") + // _userMail = kvp.Value.ToString(); + // } + + // if (isPassword) + // sEmailText = "Your password is: " + _password; + // else + // sEmailText = "Your LoginID is: " + _userId; + + // lstToAddress.Add(_userMail); + + // sEmailUtility.sSubject = "Recovery mail [" + _userMail + "]"; + + // ////// for embedding images in email + // ////if (sEmailText.Contains(" El.EmailAddress == sEmail).First().FirstName + ", "; + // } + // // AdminNames = AdminNames.Substring(0, AdminNames.Length - 2); + // sEmailText = sEmailText.Replace("#ADMINNAMES#", AdminNames); + // }*/ + + // sEmailUtility.sAlternateView = AlternateView.CreateAlternateViewFromString(sEmailText, null, "text/html"); + // foreach (var sItem in lstLinkedResource) + // { + // sEmailUtility.sAlternateView.LinkedResources.Add(sItem); + // } + + // sEmailUtility.sHostName = "10.100.12.13"; + // sEmailUtility.sFromAddress = "utkarsh.singh@ebix.com"; + // sEmailUtility.bIsBodyHtml = true; + // sEmailUtility.bEnableSsl = false; + // //sEmailUtility.sSubject = "Recovery mail [User Information]"; + // sEmailUtility.iPort = 25; + // sEmailUtility.sToAddresses = lstToAddress;//Convert.ToString(UserDetails[7]); ; + // sEmailUtility.sBccAddresses = lstBccAddress; + + // sEmailUtility.SendSmtpEmail(); + // return true; + // } + // catch (Exception ex) + // { + // return false; + // } + //} + } +} \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Web.config b/400-SOURCECODE/AIAHTML5.API/Web.config index de82813..49b4718 100644 --- a/400-SOURCECODE/AIAHTML5.API/Web.config +++ b/400-SOURCECODE/AIAHTML5.API/Web.config @@ -31,6 +31,13 @@ + + + + + + + diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll index 1981e43..090a3ef 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.dll.config b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config index de82813..ab62e5a 100644 --- a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config +++ b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config @@ -31,6 +31,13 @@ + + + + + + + diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb index 593beaa..d8d98da 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 968720c..be38c6a 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -76,17 +76,23 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.initializeAIA = function () { $rootScope.isLoading = false; - $rootScope.isVisibleLogin = true; - + $rootScope.isVisibleLogin = false; + $rootScope.isVisibleResetPass = true; + //VerifyUrlForQuerystring(); getUserDetails(); } $rootScope.userInfo = { username: null, - password: null + password: null, + emailId: null, + newpass: null, + newpass2: null }; $rootScope.userData ; - $rootScope.userModules ; + $rootScope.userModules; + + $location.search('email', $rootScope.userInfo.emailId); $rootScope.AuthenticateUser = function (userInfo) { $rootScope.isVisibleLogin = false; @@ -152,9 +158,60 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } } + $rootScope.GetUserByEmail = function (userInfo, missingPass) { + + if ((userInfo.emailId != null) && (userInfo.emailId != '')) { + if (validateEmail(userInfo.emailId)) { + if (missingPass == 'true') + userInfo.isPassword = true; + else + userInfo.isPassword = false; + + AuthenticationService.GetUserByEmail(userInfo); + } + else { + alert("Please, enter correct email id"); + } + } + else { + alert("Please, enter your email id"); + } + }; + + function validateEmail(email) { + var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + return re.test(email); + } + $(document).ready(function () { getUserDetails(); - }); + }); + + $rootScope.UpdateUserPassword = function (userInfo) { + userInfo.emailId = 'utkarsh.singh@ebix.com'; + AuthenticationService.UpdateUserPassword(userInfo) + .then( + function (result) { + if (result == LoginConstants.USER_NOT_FOUND) { + + alert(result); + } + else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) { + alert(result); + } + else { + if (result.loginId != undefined || result.loginId != "" || result.loginId != null) { + alert('Password updated successfully.'); + $rootScope.isVisibleLogin = true; + $rootScope.isVisibleResetPass = false; + } + } + }, + function (error) { + console.log(' Error in authentication = ' + error.statusText); + alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); + }); + } $rootScope.$on("$locationChangeSuccess", function () { @@ -2623,7 +2680,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic }; $rootScope.ShowPrintWindow = function () { // Print Active Viewer - html2canvas($("#canvasDiv"), { + /*html2canvas($("#canvasDiv"), { onrendered: function (canvas) { var dataURL = canvas.toDataURL("image/jpeg"); var imageToPrint = new Image(); @@ -2635,7 +2692,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic PrintDIVContent('printBox'); // Open Print Window } - }); + });*/ + OpenResetPasswordHtmlPage(); }; $rootScope.ShowPrintPreviewWindow = function (event) { // Print Preview @@ -2794,7 +2852,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic console.log('close') }); - $rootScope.ShowPrintWindow = function () { // Print Active Viewer + /*$rootScope.ShowPrintWindow = function () { // Print Active Viewer html2canvas($("#canvasDiv"), { onrendered: function (canvas) { var dataURL = canvas.toDataURL("image/jpeg"); @@ -2808,7 +2866,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic PrintDivContentByID('printBox'); // Open Print Window } }); - }; + };*/ $rootScope.restrictBodySystemList = function () { var RestrictListDiv = document.getElementById("restrictListDiv"); if (RestrictListDiv.style.display == 'block') { @@ -2820,6 +2878,36 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $(".restrict-carret-icon").css({ "transform": "rotate(90deg)", "-moz-transform": "rotate(90deg)", "-webkit-transform": "rotate(90deg)", "-ms-transform": "rotate(90deg)" }); } - + + function OpenResetPasswordHtmlPage() { + var url = 'app/views/home/resetPwd.html'; + $location.url(url); + $window.location.url(url); + }; + + function ValidateResetForm() { + //if(!('#pass').val().length) + } + + function VerifyUrlForQuerystring() { + var url = $location.url(); + + var field = 'em'; + //var url = window.location.href; + var htmFileUrl = 'app/views/Home/resetPwd.html'; // + + if (url.indexOf('?' + field + '=') != -1) { + $rootScope.isVisibleLogin = false; + $rootScope.isVisibleResetPass = true; + $(".modal-content").load(htmFileUrl).dialog({ modal: true }); + return true; + } + else { + $rootScope.isVisibleLogin = true; + $rootScope.isVisibleResetPass = false; + //$(".modal-content").load(htmFileUrl).dialog({ modal: true }); + return false; + } + } }] ); \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js index 8bcdc16..5b83031 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js @@ -16,7 +16,51 @@ deferred.reject(status); }); return deferred.promise; - } + }, + + GetUserByEmail: function (userInfo, isPassword) { + var deferred = $q.defer(); + + $http.post('/API/api/ForgotUser', userInfo, { //JSON.stringify(userEmail) + headers: { + 'Content-Type': 'application/json' + } + }) + .success(function (data, status, headers, config) { + if (data == "User not found.") + alert("User does not exists."); + else { + if (!userInfo.ispassword) { + alert("UserID sent in mail successfully."); + $('.forgot-sm').fadeOut(); + } + } + console.log('success'); + deferred.resolve(data); + }).error(function (data, status, headers, config) { + console.log('error') + deferred.reject(status); + }); + return deferred.promise; + }, + + UpdateUserPassword: function (userInfo) { + var deferred = $q.defer(); + + $http.post('/API/api/ResetPassword', JSON.stringify(userInfo), { + headers: { + 'Content-Type': 'application/json' + } + }) + .success(function (data, status, headers, config) { + console.log('success') + deferred.resolve(data); + }).error(function (data, status, headers, config) { + console.log('error') + deferred.reject(status); + }); + return deferred.promise; + }, } }); \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/Home/resetPassword.html b/400-SOURCECODE/AIAHTML5.Web/app/views/Home/resetPassword.html new file mode 100644 index 0000000..88761c9 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/Home/resetPassword.html @@ -0,0 +1,64 @@ + + + + +AIA + + + + + + + + + + + + + + +
PPL
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Reset Password
 
New Password
 
Confirm Password
 
+ + +
+
+ + diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/Home/resetPwd.html b/400-SOURCECODE/AIAHTML5.Web/app/views/Home/resetPwd.html new file mode 100644 index 0000000..0e2d1e2 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/Home/resetPwd.html @@ -0,0 +1,100 @@ +
+ + + + + + + + + + +
+ + diff --git a/400-SOURCECODE/AIAHTML5.Web/content/images/logo.png b/400-SOURCECODE/AIAHTML5.Web/content/images/logo.png new file mode 100644 index 0000000..efe029c --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.Web/content/images/logo.png diff --git a/400-SOURCECODE/AIAHTML5.Web/index.html b/400-SOURCECODE/AIAHTML5.Web/index.html index d078cbd..29bd874 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.html +++ b/400-SOURCECODE/AIAHTML5.Web/index.html @@ -9,16 +9,9 @@ A.D.A.M. Interactive Anatomy - - - - - - - @@ -30,9 +23,7 @@ - - @@ -52,7 +43,6 @@ color: #fff !important; } - .ActiveFormattingButtonClass { background-color: #1B92D0 !important; } @@ -63,7 +53,6 @@ cursor: pointer; margin-right: 2px; } - /*.italic-btn-css { background: #4B4B4B; padding: 4px; @@ -78,8 +67,6 @@ margin-right: 5px; } - - .activebtncolor { background-color: #1B92D0 !important; border-color: #1B92D0 !important; @@ -91,7 +78,6 @@ border-color: #3f3f3f; color: #ffffff; } - /*.btn-black-annotation:hover { background-color: #1B92D0 !important; border-color: #1B92D0 !important; @@ -115,7 +101,6 @@ color: #000; border-radius: 0; } - /*7931*/ .custom-tooltip-annotation-edit { background-color: #fff; @@ -149,258 +134,266 @@ color: #000; border-radius: 0; } + .restrict-carret-icon { font-size: 18px; position: relative; top: 1px; } - - - - + -
- -
-
-
- -
-
-

A.D.A.M. Interactive Anatomy

-

The most compresive online interactive anatomy learning resource

+
+
+
+
+
+ +
+
+

A.D.A.M. Interactive Anatomy

+

The most compresive online interactive anatomy learning resource

+
-
- -
-
-
- -
-
- - - + +
+
+
+ + +
+ + -
- - +
+ + +
+ Forgot User ID?
- Forgot User ID? - - -
-
- - -
- - +
+ + +
+ + +
+ Forgot Password?
- Forgot Password? -
-
- -
- +
+ +
+ +
-
-
-
- - -
-
Copyright © 2016 Ebix Inc. All rights reserved.
-
-
-
-
- - - -
- - -
-
-
> - - - -