Commit 5e151132a31131182580cc2a69c5dfd07382d29d

Authored by Utkarsh Singh
1 parent 0c00098d

Committed code refs: #15245

400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj
... ... @@ -114,7 +114,7 @@
114 114 <Compile Include="Global.asax.cs">
115 115 <DependentUpon>Global.asax</DependentUpon>
116 116 </Compile>
117   - <Compile Include="Models\UserUtility.cs" />
  117 + <Compile Include="Models\ResetUser.cs" />
118 118 <Compile Include="Models\Users.cs" />
119 119 <Compile Include="Properties\AssemblyInfo.cs" />
120 120 <Compile Include="Properties\Settings.Designer.cs">
... ...
400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs
... ... @@ -10,7 +10,7 @@ namespace AIAHTML5.API.Constants
10 10 public const string ERROR_IN_FECTHING_DETAILS = "Error in fecthing details.";
11 11 public const string USER_NOT_FOUND = "User not found.";
12 12 public const string MAIL_NOT_SENT = "Mail not sent.";
13   -
  13 + public const string MAIL_SENT = "Mail sent successfully";
14 14  
15 15  
16 16 }
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/AdminAccessController.cs
... ... @@ -27,40 +27,6 @@ namespace AIAHTML5.API.Controllers
27 27 return "value";
28 28 }
29 29  
30   - // POST api/<controller>
31   - //public HttpResponseMessage Post([FromBody]JObject userInfo)
32   - //{
33   - // ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
34   - // logger.Debug("inside POST in AdminAccessController for mail id = " + userInfo["emailId"]);
35   -
36   - // dynamic userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo);
37   - // if (Convert.ToString(userData) != AIAConstants.USER_NOT_FOUND && Convert.ToString(userData) != AIAConstants.ERROR_IN_FECTHING_DETAILS)
38   - // {
39   - // logger.Debug("inside if in AdminAccessController userData.loginId= " + userData.loginId);
40   - // bool isMailSent = false;
41   - // string userDetails = Newtonsoft.Json.JsonConvert.SerializeObject(userData);
42   -
43   - // logger.Debug("1. inside if in AdminAccessController userDetails= " + userDetails);
44   -
45   - // if (Convert.ToBoolean(userInfo["isAdmin"]))
46   - // {
47   - // logger.Debug("2: isAdmin= " + Convert.ToBoolean(userInfo["isAdmin"]));
48   -
49   - // isMailSent = AIAHTML5.API.Models.UserUtility.SendAdminRequestEmail(userData, Convert.ToBoolean(userInfo["isAdmin"]));
50   - // }
51   - // logger.Debug("isMailSent= " + isMailSent);
52   - // if (isMailSent)
53   - // return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userDetails) };
54   - // else
55   - // return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MAIL_NOT_SENT) };
56   - // }
57   - // else
58   - // {
59   - // logger.Debug("inside else in AdminAccessController userData= " + userData);
60   - // return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userData) };
61   - // }
62   - //}
63   -
64 30 public HttpResponseMessage Post([FromBody]JObject userInfo)
65 31 {
66 32 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
... ... @@ -71,12 +37,12 @@ namespace AIAHTML5.API.Controllers
71 37 {
72 38 logger.Debug("2: isAdmin= " + Convert.ToBoolean(userInfo["isAdmin"]));
73 39  
74   - isMailSent = AIAHTML5.API.Models.UserUtility.SendAdminRequestEmail(userInfo);
  40 + isMailSent = AIAHTML5.API.Models.ResetUser.SendAdminRequestEmail(userInfo);
75 41 }
76 42  
77 43 logger.Debug("isMailSent= " + isMailSent);
78 44 if (isMailSent)
79   - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent("SUCCESS") };
  45 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MAIL_SENT) };
80 46 else
81 47 return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MAIL_NOT_SENT) };
82 48 }
... ...
400-SOURCECODE/AIAHTML5.API/Models/UserUtility.cs renamed to 400-SOURCECODE/AIAHTML5.API/Models/ResetUser.cs
... ... @@ -16,7 +16,7 @@ using System.Configuration;
16 16  
17 17 namespace AIAHTML5.API.Models
18 18 {
19   - public class UserUtility
  19 + public class ResetUser
20 20 {
21 21 public static bool SendEmail(dynamic UserDetails, bool isPassword)
22 22 {
... ... @@ -81,7 +81,7 @@ namespace AIAHTML5.API.Models
81 81  
82 82  
83 83 logger.Debug("inside SendEmail for templatePath= " + templatePath + ", userId= " + userId + ", userMail= " + userMail + ",fullName= " + fullName + ",resetPasswordLink= " + resetPasswordLink);
84   - string mailBody = UserUtility.GetMailBodyTextFromTemplate(templatePath, userId, userMail, fullName, resetPasswordLink);
  84 + string mailBody = ResetUser.GetMailBodyTextFromTemplate(templatePath, userId, userMail, fullName, resetPasswordLink);
85 85  
86 86 lstToAddress.Add(userMail);
87 87  
... ... @@ -169,7 +169,7 @@ namespace AIAHTML5.API.Models
169 169 return emailBody;
170 170 }
171 171  
172   - public static bool SendAdminRequestEmail(dynamic UserDetails, bool isAdmin)
  172 + public static bool SendAdminAccessRequestEmail(dynamic UserDetails, bool isAdmin)
173 173 {
174 174 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
175 175 logger.Debug("inside SendEmail in for isAdmin =" + isAdmin);
... ... @@ -217,7 +217,7 @@ namespace AIAHTML5.API.Models
217 217 }
218 218  
219 219 logger.Debug("inside SendEmail for templatePath= " + templatePath + ", userId= " + userId + ", userMail= " + userMail + ",fullName= " + fullName + ",resetPasswordLink= " + resetPasswordLink);
220   - string mailBody = UserUtility.GetMailBodyTextFromTemplate(templatePath, userId, userMail, fullName, "");
  220 + string mailBody = ResetUser.GetMailBodyTextFromTemplate(templatePath, userId, userMail, fullName, "");
221 221  
222 222 lstToAddress.Add(userMail);
223 223  
... ... @@ -287,7 +287,7 @@ namespace AIAHTML5.API.Models
287 287  
288 288 string site_url = Convert.ToString(ConfigurationManager.AppSettings["Site_URL"]);
289 289  
290   - string[] mailToArr = (ConfigurationManager.AppSettings["AdminSupportStaff"]).Split(',');
  290 + string[] mailToArr = (ConfigurationManager.AppSettings["AdminSupport"]).Split(',');
291 291 for(int i=0; i<mailToArr.Length; i++)
292 292 {
293 293 lstToAddress.Add(mailToArr[i].ToString());
... ... @@ -317,7 +317,8 @@ namespace AIAHTML5.API.Models
317 317 lstToAddress.Add(userMail);
318 318  
319 319 //emailText = mailBody;
320   - emailText = message; // +"<br/><br/>";
  320 + emailText = message;
  321 + emailText = emailText +"<br/><br/>";
321 322  
322 323 logger.Debug("emailText= " + emailText);
323 324 // for embedding images in email
... ... @@ -338,14 +339,14 @@ namespace AIAHTML5.API.Models
338 339  
339 340 string mailSubject = string.Empty;
340 341 if (isAdmin)
341   - mailSubject = "'Admin' access request for account: ";
  342 + mailSubject = "Admin Support request initiated for:";
342 343  
343 344  
344 345 emailUtility.sHostName = Convert.ToString(ConfigurationManager.AppSettings["HostAddress"]);
345 346 emailUtility.sFromAddress = Convert.ToString(ConfigurationManager.AppSettings["SenderEmailAddress"]);
346 347 emailUtility.bIsBodyHtml = true;
347 348 emailUtility.bEnableSsl = false;
348   - emailUtility.sSubject = mailSubject + userMail;
  349 + emailUtility.sSubject = mailSubject + " " + userMail;
349 350 //sEmailUtility.sBodyText = sEmailText;
350 351 emailUtility.iPort = 25;
351 352 emailUtility.sToAddresses = lstToAddress;
... ...
400-SOURCECODE/AIAHTML5.API/Templates/admin-Request.html deleted
1   -<style type='text/css'>
2   - strong {
3   - font-size: 18px;
4   - color: #ffff00;
5   - }
6   -</style>
7   -<table width='500' border='0' align='center' cellpadding='0' cellspacing='0'>
8   - <tbody>
9   - <tr>
10   - <td align='center' valign='middle' bgcolor='#393939' style='padding:30px 0 20px 0;'>
11   - <a href='#'><img src='{logoPath}' alt='AIA' title='AIA' /></a>
12   - </td>
13   - </tr>
14   - <tr>
15   - <td align='center' valign='top' bgcolor='#808d43' style='padding:20px;'>
16   - <table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>
17   - <tbody>
18   - <tr>
19   - <td colspan='2' style=' font-size:32px; font-weight:bold; color:#fff; font-family:Gotham, Helvetica, Arial, sans-serif'>Request for Admin Access</td>
20   - </tr>
21   - <tr>
22   - <td colspan='2'>&nbsp;</td>
23   - </tr>
24   - <tr>
25   - <td colspan='2' style='font-size:20px; font-weight:bold; color:#fff; font-family:Gotham, Helvetica, Arial, sans-serif'>Hello {userFullName}</td>
26   - </tr>
27   - <tr>
28   - <td colspan='2'>&nbsp;</td>
29   - </tr>
30   - <tr>
31   - <td colspan='2' style=' font-size:16px; font-weight:bold; color:#fff; font-family:Gotham, Helvetica, Arial, sans-serif'>You have requested 'admin' access for following account: {emailId}</td>
32   - </tr>
33   - <tr>
34   - <td colspan='2'>&nbsp;</td>
35   - </tr>
36   - <tr>
37   - <td colspan='2' style=' font-size:16px; font-weight:bold; color:#fff; font-family:Gotham, Helvetica, Arial, sans-serif'>{usermessage}</td>
38   - </tr>
39   - <tr>
40   - <td colspan='2'>&nbsp;</td>
41   - </tr>
42   - <tr>
43   - <td colspan='2' style=' font-size:18px; font-family:Gotham, Helvetica, Arial, sans-serif; color:#fff;'>Your request has been registered and has been intimated to referenced authority simultaneously. </td>
44   - </tr>
45   - <tr>
46   - <td colspan='2'>&nbsp;</td>
47   - </tr>
48   - <tr>
49   - <td colspan='2'>&nbsp;</td>
50   - </tr>
51   - <tr>
52   - <td colspan='2'>&nbsp;</td>
53   - </tr>
54   - </tbody>
55   - </table>
56   - </td>
57   - </tr>
58   - <tr>
59   - <td bgcolor='#f9f2e7' style='padding:20px;'>
60   - <table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>
61   - <tbody>
62   - <tr>
63   - <td style=' font-size:12px; font-family:Gotham, Helvetica, Arial, sans-serif; color:#000000;'>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.</td>
64   - </tr>
65   - <tr>
66   - <td style=' font-size:12px; font-family:Gotham, Helvetica, Arial, sans-serif; color:#000000;'>&nbsp;</td>
67   - </tr>
68   - <tr>
69   - <td style=' font-size:12px; font-family:Gotham, Helvetica, Arial, sans-serif; color:#000000;'>Give us a <b>call toll-free at 1-888-278-9614</b> or <em>send us an email</em> if you have any questions or if you need help. It will be our pleasure to help you.</td>
70   - </tr>
71   - <tr><td style=' font-size:12px; font-family:Gotham, Helvetica, Arial, sans-serif; color:#000000;'>&nbsp;</td></tr>
72   - <tr><td style=' font-size:12px; font-family:Gotham, Helvetica, Arial, sans-serif; color:#000000;'>&nbsp;</td></tr>
73   - <tr>
74   - <td style=' font-size:12px; font-family:Gotham, Helvetica, Arial, sans-serif; color:#000000;'><em>&copy; 2017 Ebix, Inc. All Rights Reserved. </em></td>
75   - </tr>
76   - </tbody>
77   - </table>
78   - </td>
79   - </tr>
80   - </tbody>
81   -</table>
82 0 \ No newline at end of file
400-SOURCECODE/AIAHTML5.API/Web.config
... ... @@ -40,7 +40,8 @@
40 40 <add key="Site_Url" value ="//52.2.38.120"/>
41 41 <add key ="HostAddress" value="10.100.12.13" />
42 42 <add key="isUserAuthenticated" value="false"/>
43   - </appSettings>
  43 + <add key="AdminSupport" value=""/>
  44 + </appSettings>
44 45 <system.web>
45 46 <compilation debug="true" targetFramework="4.5" />
46 47 <httpRuntime targetFramework="4.5" />
... ...
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config
... ... @@ -40,7 +40,8 @@
40 40 <add key="Site_Url" value ="//52.2.38.120"/>
41 41 <add key ="HostAddress" value="10.100.12.13" />
42 42 <add key="isUserAuthenticated" value="false"/>
43   - </appSettings>
  43 + <add key="AdminSupport" value=""/>
  44 + </appSettings>
44 45 <system.web>
45 46 <compilation debug="true" targetFramework="4.5" />
46 47 <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
1 1 'use strict';
2 2  
3   -AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService", "AuthenticationService", "LoginConstants","UserModules","LoginMessageConstants","AdminService",
4   -function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants, UserModules, LoginMessageConstants, AdminService) {
  3 +AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService", "AuthenticationService", "LoginConstants","UserModules","LoginMessageConstants","AdminService", "AdminConstants",
  4 +function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants, UserModules, LoginMessageConstants, AdminService, AdminConstants) {
5 5  
6 6 //$scope.pageToOpen = {
7 7 // name: 'MainMenu'
... ... @@ -3313,87 +3313,53 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3313 3313 }
3314 3314  
3315 3315 $rootScope.OpenAdminForm = function (userInfo) {
3316   -
3317   - //if ($rootScope.userData) {
3318   - $('#fName').val('Utkarsh');
3319   - $('#lName').val('Singh');
3320   - $('#emailId').val('utkarsh.singh@ebix.com');
3321   - //}
  3316 + $('#adminModal').css({ top: '50px' });
  3317 + if ($rootScope.userData) {
  3318 + $('#adminfName').val($rootScope.userData.firstName);
  3319 + $('#adminlName').val($rootScope.userData.lastName);
  3320 + $('#adminEmailId').val($rootScope.userData.emailId);
  3321 + }
3322 3322 };
3323 3323  
3324 3324 $rootScope.SendAdminAccessRequestMail = function (userInfo) {
3325   - userInfo.isAdmin = true;
  3325 +
3326 3326 if ($rootScope.userData) {
3327   - }
3328   -
3329   - userInfo.firstName = "Utkarsh";
3330   - userInfo.lastName = "Singh";
3331   - userInfo.emailId = "utkarsh.singh@ebix.com";
3332   - var msg = $('#userMessage').text();
3333   - if (userInfo.userMessage==null)
3334   - userInfo.userMessage = msg;
3335   -
3336   - if ((userInfo.emailId != null) && (userInfo.emailId != '')) {
3337   - if (validateEmail(userInfo.emailId)) {
3338   -
3339   - AdminService.SendAdminRequestMail(userInfo)
3340   - .then(function (result) {
3341   - if (result == LoginConstants.USER_NOT_FOUND) {
3342   - $rootScope.errorMassage = LoginMessageConstants.INCORRECT_EMAIL_ID;
3343   - $("#messageModal").modal('show');
3344   - }
3345   - else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) {
3346   - $rootScope.errorMassage = LoginMessageConstants.ERROR_IN_FECTHING_DETAILS;
3347   - $("#messageModal").modal('show');
3348   - }
3349   - else if (result == LoginConstants.MAIL_NOT_SENT) {
3350   - $rootScope.errorMassage = LoginMessageConstants.MAIL_NOT_SENT;
  3327 + userInfo.firstName = $rootScope.userData.firstName;
  3328 + userInfo.lastName = $rootScope.userData.lastName;
  3329 + userInfo.emailId = $rootScope.userData.emailId;
  3330 + userInfo.isAdmin = true;
  3331 + }
  3332 +
  3333 + if (userInfo.userMessage != undefined && userInfo.userMessage != '' && userInfo.userMessage != null) {
  3334 +
  3335 + AdminService.SendAdminAccessRequestMail(userInfo)
  3336 + .then(function (result) {
  3337 + if (result == AdminConstants.MAIL_SENT) {
  3338 + $("#adminModal").fadeOut();
  3339 + $("#adminModal").modal('hide');
  3340 + $("adminAccessTextArea").text('');
  3341 +
  3342 + $rootScope.errorMassage = AdminConstants.ADMIN_ACCESS_REQUEST_SUCCESS;
3351 3343 $("#messageModal").modal('show');
3352 3344 }
3353   - else {
3354   - if (result.loginId != undefined || result.loginId != "" || result.loginId != null) {
3355   - var message;
3356   - if ($('.forgot-sm').length > 0) {
3357   - $('.forgot-sm').fadeOut();
3358   - $('.forgot-sm').modal('hide');
3359   - }
3360   - if ($('.forgot-sm1').length > 0) {
3361   - $('.forgot-sm1').fadeOut();
3362   - $('.forgot-sm1').modal('hide');
3363   - }
3364   - //if (isMailForPassword)
3365   - // message = LoginMessageConstants.RESET_PASSWORD;
3366   - //else
3367   - message = LoginMessageConstants.USERID_SENT_IN_EMAIL
3368   - //alert(message);
3369   - $rootScope.errorMassage = message;
3370   - $("#messageModal").modal('show');
3371   -
3372   -
3373   - }
3374   - }
3375   -
3376   - },
3377   - function (error) {
3378   - console.log(' Error in authentication = ' + error.statusText);
3379   - // alert(LoginConstants.ERROR_IN_FECTHING_DETAILS);
3380   - $rootScope.errorMassage = LoginConstants.ERROR_IN_FECTHING_DETAILS;
3381   - $("#messageModal").modal('show');
3382   - });
3383   - }
3384   - else {
3385   - // alert(LoginMessageConstants.INCORRECT_EMAIL_ID);
3386   - $rootScope.errorMassage = LoginMessageConstants.INCORRECT_EMAIL_ID;
  3345 + },
  3346 + function (error) {
  3347 + console.log(' Error in intimating admin support = ' + error.statusText);
  3348 + $rootScope.errorMassage = AdminConstants.ERROR_IN_SENDING_MAIL;
3387 3349 $("#messageModal").modal('show');
3388   - }
  3350 + });
3389 3351 }
3390 3352 else {
3391   - //alert(LoginMessageConstants.BLANK_EMAIL_ID);
3392   - $rootScope.errorMassage = LoginMessageConstants.BLANK_EMAIL_ID;
3393   - $("#messageModal").modal('show');
  3353 + $rootScope.errorMassage = AdminConstants.BLANK_ACCESS_MESSAGE;
  3354 + $("#spnError").text(AdminConstants.BLANK_ACCESS_MESSAGE);
3394 3355  
3395 3356 }
3396 3357 };
3397 3358  
  3359 + $rootScope.CloseAAModal = function () {
  3360 + $("#adminModal").fadeOut();
  3361 + $("#adminModal").modal('hide');
  3362 + $("adminAccessTextArea").text('');
  3363 + }
3398 3364 }]
3399 3365 );
3400 3366 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
... ... @@ -310,6 +310,12 @@ AIA.constant(&quot;LoginMessageConstants&quot;, {
310 310 //"MAIL_NOT_SENT": "Mail not sent."
311 311  
312 312 })
  313 +AIA.constant("AdminConstants", {
  314 + "ADMIN_ACCESS_REQUEST_SUCCESS": "Mail has been sent to referenced authorities.",
  315 + "BLANK_ACCESS_MESSAGE": "Please, type some message before submitting.",
  316 + "ERROR_IN_SENDING_MAIL": "Some internal error occured.",
  317 + "MAIL_SENT": "Mail sent successfully"
  318 +})
313 319 AIA.constant("UserModules", [
314 320 {
315 321 "name": "Dissectible Anatomy",
... ...
400-SOURCECODE/AIAHTML5.Web/app/services/AdminService.js
1 1 AIA.factory('AdminService', function ($http, $q) {
2 2 return {
3   - SendAdminRequestMail: function (userInfo) {
  3 + SendAdminAccessRequestMail: function (userInfo) {
4 4 var deferred = $q.defer();
5 5  
6   - $http.post('/API/api/AdminAccess', userInfo, { //JSON.stringify(userEmail)
  6 + $http.post('/API/api/AdminAccess', userInfo, {
7 7 headers: {
8 8 'Content-Type': 'application/json'
9 9 }
... ...
400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html
... ... @@ -49,7 +49,7 @@
49 49 <li><a href="#">About A.D.A.M.</a></li>
50 50 </ul>
51 51 </li>
52   - <li><a ng-click="OpenAdminForm()" role="button" data-toggle="modal" class="btn" data-target="#adminModal">Admin</a></li><!--href="#" class=""btn-primary btn-lg"-->
  52 + <li><a ng-click="OpenAdminForm()" role="button" data-toggle="modal" class="btn" data-target="#adminModal">Admin</a></li>
53 53 </ul>
54 54 <ul class="nav navbar-nav navbar-right">
55 55 <li class="visible-xs"><a href="" ng-click="LogoutUser()">Logout</a></li>
... ...