From a60041989b5211ef052e80e8c2e86b2ae335d8b1 Mon Sep 17 00:00:00 2001 From: Utkarsh Singh Date: Tue, 7 Mar 2017 18:28:37 +0530 Subject: [PATCH] Committed --- 400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj | 1 + 400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs | 4 ++-- 400-SOURCECODE/AIAHTML5.API/Models/ResetUser.cs | 16 +++++++++++++--- 400-SOURCECODE/AIAHTML5.API/Templates/admin-Request.html | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html | 2 +- 400-SOURCECODE/AIAHTML5.Web/index.html | 40 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 272 insertions(+), 6 deletions(-) create mode 100644 400-SOURCECODE/AIAHTML5.API/Templates/admin-Request.html diff --git a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj index 8147fb3..1445e08 100644 --- a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj +++ b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj @@ -97,6 +97,7 @@ + diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs index e0ef377..f364ee9 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs @@ -49,13 +49,13 @@ namespace AIAHTML5.API.Controllers { logger.Debug("2. isPassword= " + Convert.ToBoolean(userInfo["isPassword"])); - isMailSent = AIAHTML5.API.Models.ResetUser.SendEmail(userData, true); + isMailSent = AIAHTML5.API.Models.UserUtility.SendEmail(userData, true); } else { logger.Debug("3. isPassword= " + Convert.ToBoolean(userInfo["isPassword"])); - isMailSent = AIAHTML5.API.Models.ResetUser.SendEmail(userData, false); + isMailSent = AIAHTML5.API.Models.UserUtility.SendEmail(userData, false); } logger.Debug("isMailSent= " + isMailSent); if (isMailSent) diff --git a/400-SOURCECODE/AIAHTML5.API/Models/ResetUser.cs b/400-SOURCECODE/AIAHTML5.API/Models/ResetUser.cs index e90deb6..7bb2efb 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/ResetUser.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/ResetUser.cs @@ -16,7 +16,7 @@ using System.Configuration; namespace AIAHTML5.API.Models { - public class ResetUser + public class UserUtility { public static bool SendEmail(dynamic UserDetails, bool isPassword) { @@ -36,7 +36,8 @@ namespace AIAHTML5.API.Models string userName = string.Empty; string fName = string.Empty; string lName = string.Empty; - string site_url = Convert.ToString(ConfigurationManager.AppSettings["Site_URL"]); + string site_url = Convert.ToString(ConfigurationManager.AppSettings["Site_URL"]); + bool isAdminRequest = false; foreach (KeyValuePair kvp in UserDetails) { @@ -51,6 +52,9 @@ namespace AIAHTML5.API.Models if (kvp.Key == "lastName") lName = kvp.Value.ToString(); + + if(kvp.Key == "admin") + isAdminRequest = true; } string fullName = fName + " " + lName; @@ -68,8 +72,11 @@ namespace AIAHTML5.API.Models else templatePath = "~/Templates/forgot-UserId.html"; + if(isAdminRequest) + templatePath = "~/Templates/admin-Request.html"; + logger.Debug("inside SendEmail for templatePath= " + templatePath + ", userId= " + userId + ", userMail= " + userMail + ",fullName= " + fullName + ",resetPasswordLink= " + resetPasswordLink); - string mailBody = ResetUser.GetMailBodyTextFromTemplate(templatePath, userId, userMail, fullName, resetPasswordLink); + string mailBody = UserUtility.GetMailBodyTextFromTemplate(templatePath, userId, userMail, fullName, resetPasswordLink); lstToAddress.Add(userMail); @@ -98,6 +105,9 @@ namespace AIAHTML5.API.Models else mailSubject = "Password recovery mail for: "; + if (isAdminRequest) + mailSubject = "Administrator request for: "; + emailUtility.sHostName = Convert.ToString(ConfigurationManager.AppSettings["HostAddress"]); emailUtility.sFromAddress = Convert.ToString(ConfigurationManager.AppSettings["SenderEmailAddress"]); emailUtility.bIsBodyHtml = true; diff --git a/400-SOURCECODE/AIAHTML5.API/Templates/admin-Request.html b/400-SOURCECODE/AIAHTML5.API/Templates/admin-Request.html new file mode 100644 index 0000000..ad8a18d --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.API/Templates/admin-Request.html @@ -0,0 +1,75 @@ + + + + + + + + + + + + + +
+ AIA +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Admin Access Request
 
Hello {userFullName}
 
You have requested 'admin' access for following account: {emailId}
 
Your request has been registered and intimated to referenced authority.
 
 
 
+
+ + + + + + + + + + + + + + + + + +
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.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index c2ff1c1..0cfed80 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -3309,5 +3309,145 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } + $rootScope.OpenAdminForm = function (userInfo) { + getUserDetails(); + if ($rootScope.userData) { + $('#fName').val(userInfo.firstName); + $('#lName').val(userInfo.lastName); + $('#email').val(userInfo.emailId); + } + /*$('#testFormAdmin').attr('display', 'block'); + $('#testFormAdmin').toggle();*/ + userInfo.firstName = 'Utkarsh'; + userInfo.lastName = 'Singh'; + userInfo.emailId = 'utkarsh.singh@ebix.com'; + + if ((userInfo.emailId != null) && (userInfo.emailId != '')) { + if (validateEmail(userInfo.emailId)) { + isMailForPassword = 'admin'; + + AuthenticationService.SendMailToUser(userInfo) + .then(function (result) { + if (result == LoginConstants.USER_NOT_FOUND) { + $rootScope.errorMassage = LoginMessageConstants.INCORRECT_EMAIL_ID; + $("#messageModal").modal('show'); + } + else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) { + $rootScope.errorMassage = LoginMessageConstants.ERROR_IN_FECTHING_DETAILS; + $("#messageModal").modal('show'); + } + else if (result == LoginConstants.MAIL_NOT_SENT) { + $rootScope.errorMassage = LoginMessageConstants.MAIL_NOT_SENT; + $("#messageModal").modal('show'); + } + 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 = LoginMessageConstants.RESET_PASSWORD; + else + message = LoginMessageConstants.USERID_SENT_IN_EMAIL + //alert(message); + $rootScope.errorMassage = message; + $("#messageModal").modal('show'); + + + } + } + + }, + function (error) { + console.log(' Error in authentication = ' + error.statusText); + // alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); + $rootScope.errorMassage = LoginConstants.ERROR_IN_FECTHING_DETAILS; + $("#messageModal").modal('show'); + }); + } + else { + // alert(LoginMessageConstants.INCORRECT_EMAIL_ID); + $rootScope.errorMassage = LoginMessageConstants.INCORRECT_EMAIL_ID; + $("#messageModal").modal('show'); + } + } + else { + //alert(LoginMessageConstants.BLANK_EMAIL_ID); + $rootScope.errorMassage = LoginMessageConstants.BLANK_EMAIL_ID; + $("#messageModal").modal('show'); + + } + }; + + /*function SendMailFromAdmin(userInfo, isMailForPassword) { + if ((userInfo.emailId != null) && (userInfo.emailId != '')) { + if (validateEmail(userInfo.emailId)) { + isMailForPassword = 'admin'; + + AuthenticationService.SendMailToUser(userInfo) + .then(function (result) { + if (result == LoginConstants.USER_NOT_FOUND) { + $rootScope.errorMassage = LoginMessageConstants.INCORRECT_EMAIL_ID; + $("#messageModal").modal('show'); + } + else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) { + $rootScope.errorMassage = LoginMessageConstants.ERROR_IN_FECTHING_DETAILS; + $("#messageModal").modal('show'); + } + else if (result == LoginConstants.MAIL_NOT_SENT) { + $rootScope.errorMassage = LoginMessageConstants.MAIL_NOT_SENT; + $("#messageModal").modal('show'); + } + 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 = LoginMessageConstants.RESET_PASSWORD; + else + message = LoginMessageConstants.USERID_SENT_IN_EMAIL + //alert(message); + $rootScope.errorMassage = message; + $("#messageModal").modal('show'); + + + } + } + + }, + function (error) { + console.log(' Error in authentication = ' + error.statusText); + // alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); + $rootScope.errorMassage = LoginConstants.ERROR_IN_FECTHING_DETAILS; + $("#messageModal").modal('show'); + }); + } + else { + // alert(LoginMessageConstants.INCORRECT_EMAIL_ID); + $rootScope.errorMassage = LoginMessageConstants.INCORRECT_EMAIL_ID; + $("#messageModal").modal('show'); + } + } + else { + //alert(LoginMessageConstants.BLANK_EMAIL_ID); + $rootScope.errorMassage = LoginMessageConstants.BLANK_EMAIL_ID; + $("#messageModal").modal('show'); + + } + };*/ + }] ); \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html b/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html index dce6323..51dff7b 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html @@ -49,7 +49,7 @@
  • About A.D.A.M.
  • -
  • Admin
  • +
  • Admin