diff --git a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj index 94851ca..8147fb3 100644 --- a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj +++ b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj @@ -95,7 +95,10 @@ + + + Designer @@ -104,9 +107,12 @@ + + Global.asax + @@ -114,6 +120,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..3a600f7 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs @@ -0,0 +1,71 @@ +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"); + + 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 isMailSent = false; + string userDetails = Newtonsoft.Json.JsonConvert.SerializeObject(userData); + if (Convert.ToBoolean(userInfo["isPassword"])) + isMailSent = AIAHTML5.API.Models.ResetUser.SendEmail(userData, true); + else + isMailSent = AIAHTML5.API.Models.ResetUser.SendEmail(userData, false); + + if (isMailSent) + 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..13f3ec1 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs @@ -0,0 +1,71 @@ +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; + string upInfo; + if (!String.IsNullOrEmpty(userInfo["newPassword"].ToString())) + { + updatedInfo = AIAHTML5.API.Models.Users.UpdatePassword(userInfo); + 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.BadRequest, Content = new StringContent("Nothing to update") }; + } + else + { + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = 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..4e24e14 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/Models/ResetUser.cs @@ -0,0 +1,146 @@ +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; +using System.Configuration; + +namespace AIAHTML5.API.Models +{ + public class ResetUser + { + public static bool SendEmail(dynamic UserDetails, bool isPassword) + { + try + { + List lstLinkedResource = new List(); + EmailUtility emailUtility = new EmailUtility(); + List lstToAddress = new List(); + List lstBccAddress = new List(); + + string emailText = string.Empty; + string userId = string.Empty; + string userMail = string.Empty; + string userName = string.Empty; + string fName = string.Empty; + string lName = string.Empty; + string site_url = Convert.ToString(ConfigurationManager.AppSettings["Site_URL"]); + + foreach (KeyValuePair kvp in UserDetails) + { + if (kvp.Key == "loginId") + userId = 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; + + string logoPath = HttpContext.Current.Server.MapPath("~/content/images/logo.png"); + + string templatePath = string.Empty; + string resetPasswordLink = string.Empty; + + if (isPassword) + { + templatePath = "~/Templates/forgot-Password.html"; + resetPasswordLink = site_url + "?em:" + HttpUtility.UrlEncode(userMail); + } + else + templatePath = "~/Templates/forgot-UserId.html"; + + string mailBody = ResetUser.GetMailBodyTextFromTemplate(templatePath, userId, userMail, fullName, resetPasswordLink); + + lstToAddress.Add(userMail); + + emailText = mailBody; + + + // for embedding images in email + if (emailText.Contains(".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,68 @@ 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"); + var filter = Builders.Filter.Eq("emailId", userInfo["emailId"].ToString()); + var update = Builders.Update.Set("password", userInfo["newPassword"].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..125f479 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs @@ -0,0 +1,118 @@ +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"]); + + 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; + + using (MailMessage mm = new MailMessage(sFromAddress, sMail.To.ToString())) + { + mm.Subject = sSubject; + mm.IsBodyHtml = bIsBodyHtml; + + if (sAlternateView != null) + { + mm.AlternateViews.Add(sAlternateView); + } + else + { + mm.Body = sBodyText; + } + + mm.IsBodyHtml = true; + SendMail(mm); + } + + } + catch (Exception ex) + { + throw ex; + } + } + } +} \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Web.config b/400-SOURCECODE/AIAHTML5.API/Web.config index de82813..f60359f 100644 --- a/400-SOURCECODE/AIAHTML5.API/Web.config +++ b/400-SOURCECODE/AIAHTML5.API/Web.config @@ -31,6 +31,14 @@ + + + + + + + + diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll index 1981e43..c65b7d8 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..3c4b171 100644 --- a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config +++ b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config @@ -31,6 +31,14 @@ + + + + + + + + diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb index 593beaa..a8486a7 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.API/content/images/logo.png b/400-SOURCECODE/AIAHTML5.API/content/images/logo.png new file mode 100644 index 0000000..efe029c --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/content/images/logo.png diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 644654a..251d6bc 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -73,60 +73,69 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic - $rootScope.initializeAIA = function () { + $rootScope.initializeAIA = function () { - $rootScope.isLoading = false; + $rootScope.isLoading = false; + //$rootScope.isVisibleLogin = false; + //$rootScope.isVisibleResetPass = true; + VerifyUrlForQuerystring(); + getUserDetails(); + } + + $rootScope.userInfo = { + username: null, + password: null, + emailId: null, + isPassword: null, + newPassword: null, + confirmPassword: null + }; + $rootScope.userData; + $rootScope.userModules; + $rootScope.errorMesaage; + + $rootScope.AuthenticateUser = function (userInfo) { + $rootScope.isVisibleLogin = false; + if (userInfo.username == "" || userInfo.username == null || userInfo.password == "" || userInfo.password == null) { + + alert("Please enter correct information"); $rootScope.isVisibleLogin = true; - - getUserDetails(); } + else { - $rootScope.userInfo = { - username: null, - password: null - }; - $rootScope.userData ; - $rootScope.userModules ; - - $rootScope.AuthenticateUser = function (userInfo) { - $rootScope.isVisibleLogin = false; - if (userInfo.username == "" || userInfo.username == null || userInfo.password == "" || userInfo.password == null) { - - alert("Please enter correct information"); - - } - else { - - AuthenticationService.authenticateUser(userInfo) - .then( + AuthenticationService.authenticateUser(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) { + function (result) { + if (result == LoginConstants.USER_NOT_FOUND) { + $rootScope.isVisibleLogin = true; + alert(LoginConstants.USER_NOT_FOUND); + + } + else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) { + alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); + $rootScope.isVisibleLogin = true; + } + else { + if (result.loginId != undefined || result.loginId != "" || result.loginId != null) { - $rootScope.userData = result; - $rootScope.userModules = result.modules; - $rootScope.isVisibleLogin = false; + $rootScope.userData = result; + $rootScope.userModules = result.modules; + $rootScope.isVisibleLogin = false; - localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); - } + localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); } - }, - function (error) { - console.log(' Error in authentication = ' + error.statusText); - alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); - }); - } - + } + }, + function (error) { + console.log(' Error in authentication = ' + error.statusText); + alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); + $rootScope.isVisibleLogin = true; + }); } + } + $rootScope.LogoutUser = function () { localStorage.removeItem('loggedInUserDetails'); document.location = '/'; @@ -152,10 +161,116 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } } - $(document).ready(function () { - getUserDetails(); + $rootScope.SendMailToUser = function (userInfo, isMailForPassword) { + if ((userInfo.emailId != null) && (userInfo.emailId != '')) { + if (validateEmail(userInfo.emailId)) { + if (isMailForPassword == 'true') + userInfo.isPassword = true; + else + userInfo.isPassword = false; + + AuthenticationService.SendMailToUser(userInfo) + .then(function (result) { + if (result == LoginConstants.USER_NOT_FOUND) { + alert("Error occured."); + } + else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) { + alert("Error occured."); + } + else { + if (result.loginId != undefined || result.loginId != "" || result.loginId != null) { + var message; + if ($('.forgot-sm').length > 0) { + $('.forgot-sm').fadeOut(); + $('.forgot-sm').modal('hide'); + } + if ($('.forgot-sm1').length > 0) { + $('.forgot-sm1').fadeOut(); + $('.forgot-sm1').modal('hide'); + } + if (isMailForPassword) + message = "Password"; + else + message = "UserId"; + alert(message + " sent in mail successfully."); + } + } + + }, + function (error) { + console.log(' Error in authentication = ' + error.statusText); + alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); + }); + } + else { + alert("Please enter correct email id"); + } + } + else { + alert("Please enter your email id"); + } + }; + + $rootScope.closeResetPasswordPopup = function () { + $("#passwordReset").fadeOut(); + $("#passwordReset").modal('hide'); + } + + 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); + } + + $rootScope.ResetUserPassword = function (userInfo) { + var url = $location.url(); + if (url.indexOf('?em:') != -1) { + var split = url.split('?em:'); + userInfo.emailId = split[1]; + } + + if (userInfo.newPassword === userInfo.confirmPassword) { + $rootScope.errorMesaage = null; + AuthenticationService.ResetUserPassword(userInfo) + .then( + function (result) { + if (result == LoginConstants.USER_NOT_FOUND) { + alert(LoginConstants.USER_NOT_FOUND); + } + else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) { + alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); + } + else { + if (result.loginId != undefined || result.loginId != "" || result.loginId != null) { + alert('Your password has been reset.'); + $rootScope.isVisibleLogin = true; + $rootScope.isVisibleResetPass = false; + $location.url() = "/"; + } + } + }, + function (error) { + console.log(' Error in authentication = ' + error.statusText); + alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); + }); + } + else + $rootScope.errorMesaage = "Your new password and confirm password not matched!"; + } + + function VerifyUrlForQuerystring() { + var url = $location.url(); + var field = 'em'; + if (url.indexOf('?' + field + ':') != -1) { + $rootScope.isVisibleLogin = false; + $rootScope.isVisibleResetPass = true; + } + else { + $rootScope.isVisibleLogin = true; + $rootScope.isVisibleResetPass = false; + } + } $(function () { var colpick = $('.demo').each(function () { @@ -223,7 +338,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $inlinehex.html(hex); } }); - }); + //}); $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); $("#drawTextBGColorpicker .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#ffffff" }); @@ -2741,9 +2856,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $('#snipImage').attr('src', dataURL); $('#spnModule').text($rootScope.currentActiveModuleTitle); - $('#spnPosture').text(localStorage.getItem('currentViewTitle')); + $('#spnBodyViewTitle').text(localStorage.getItem('currentViewTitle')); - PrintDIVContent('printBox'); // Open Print Window + PrintDivContentByID('printBox'); // Open Print Window } }); }; @@ -2904,21 +3019,6 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic console.log('close') }); - $rootScope.ShowPrintWindow = function () { // Print Active Viewer - html2canvas($("#canvasDiv"), { - onrendered: function (canvas) { - var dataURL = canvas.toDataURL("image/jpeg"); - var imageToPrint = new Image(); - imageToPrint.src = dataURL; - $('#snipImage').attr('src', dataURL); - - $('#spnModule').text($rootScope.currentActiveModuleTitle); - $('#spnBodyViewTitle').text(localStorage.getItem('currentViewTitle')); - - PrintDivContentByID('printBox'); // Open Print Window - } - }); - }; $rootScope.restrictBodySystemList = function () { var RestrictListDiv = document.getElementById("restrictListDiv"); if (RestrictListDiv.style.display == 'block') { @@ -2929,7 +3029,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic RestrictListDiv.style.display = 'block'; $(".restrict-carret-icon").css({ "transform": "rotate(90deg)", "-moz-transform": "rotate(90deg)", "-webkit-transform": "rotate(90deg)", "-ms-transform": "rotate(90deg)" }); - } + }; }] ); \ 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..76d14c8 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js @@ -16,7 +16,43 @@ deferred.reject(status); }); return deferred.promise; - } + }, + + SendMailToUser: 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) { + console.log('success'); + deferred.resolve(data); + }).error(function (data, status, headers, config) { + console.log('error') + deferred.reject(status); + }); + return deferred.promise; + }, + + ResetUserPassword: 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/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 0a303d3..4866cbd 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.html +++ b/400-SOURCECODE/AIAHTML5.Web/index.html @@ -149,6 +149,7 @@ color: #000; border-radius: 0; } + .restrict-carret-icon { font-size: 18px; position: relative; @@ -160,247 +161,297 @@ -
- -
-
-
- -
-
-

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.
+
+
+ +