Commit 0fd23b0d05bb574e34d7001d3ea0cf82e75eaa53

Authored by Utkarsh Singh
1 parent a6004198

Committed code

400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj
... ... @@ -107,13 +107,14 @@
107 107 <ItemGroup>
108 108 <Compile Include="App_Start\WebApiConfig.cs" />
109 109 <Compile Include="Constants\AIAConstants.cs" />
  110 + <Compile Include="Controllers\AdminAccessController.cs" />
110 111 <Compile Include="Controllers\AuthenticateController.cs" />
111 112 <Compile Include="Controllers\ForgotUserController.cs" />
112 113 <Compile Include="Controllers\ResetPasswordController.cs" />
113 114 <Compile Include="Global.asax.cs">
114 115 <DependentUpon>Global.asax</DependentUpon>
115 116 </Compile>
116   - <Compile Include="Models\ResetUser.cs" />
  117 + <Compile Include="Models\UserUtility.cs" />
117 118 <Compile Include="Models\Users.cs" />
118 119 <Compile Include="Properties\AssemblyInfo.cs" />
119 120 <Compile Include="Properties\Settings.Designer.cs">
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/AdminAccessController.cs 0 → 100644
  1 +using System;
  2 +using System.Collections.Generic;
  3 +using System.Linq;
  4 +using System.Net;
  5 +using System.Net.Http;
  6 +using System.Web.Http;
  7 +using AIAHTML5.API.Constants;
  8 +using log4net;
  9 +using Newtonsoft.Json;
  10 +using Newtonsoft.Json.Linq;
  11 +using AIAHTML5.API.Models;
  12 +using AIAHTML5.API.Utility;
  13 +
  14 +namespace AIAHTML5.API.Controllers
  15 +{
  16 + public class AdminAccessController : ApiController
  17 + {
  18 + // GET api/<controller>
  19 + public IEnumerable<string> Get()
  20 + {
  21 + return new string[] { "value1", "value2" };
  22 + }
  23 +
  24 + // GET api/<controller>/5
  25 + public string Get(int id)
  26 + {
  27 + return "value";
  28 + }
  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 + public HttpResponseMessage Post([FromBody]JObject userInfo)
  65 + {
  66 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  67 + logger.Debug("inside POST in AdminAccessController for mail id = " + userInfo["emailId"]);
  68 + bool isMailSent = false;
  69 +
  70 + if (Convert.ToBoolean(userInfo["isAdmin"]))
  71 + {
  72 + logger.Debug("2: isAdmin= " + Convert.ToBoolean(userInfo["isAdmin"]));
  73 +
  74 + isMailSent = AIAHTML5.API.Models.UserUtility.SendAdminRequestEmail(userInfo);
  75 + }
  76 +
  77 + logger.Debug("isMailSent= " + isMailSent);
  78 + if (isMailSent)
  79 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent("SUCCESS") };
  80 + else
  81 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MAIL_NOT_SENT) };
  82 + }
  83 +
  84 + // PUT api/<controller>/5
  85 + public void Put(int id, [FromBody]string value)
  86 + {
  87 + }
  88 +
  89 + // DELETE api/<controller>/5
  90 + public void Delete(int id)
  91 + {
  92 + }
  93 + }
  94 +}
0 95 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Models/ResetUser.cs renamed to 400-SOURCECODE/AIAHTML5.API/Models/UserUtility.cs
... ... @@ -12,15 +12,15 @@ using AIAHTML5.API.Utility;
12 12 using System.Text;
13 13 using System.IO;
14 14 using System.Net.Mime;
15   -using System.Configuration;
  15 +using System.Configuration;
16 16  
17 17 namespace AIAHTML5.API.Models
18 18 {
19 19 public class UserUtility
20 20 {
21 21 public static bool SendEmail(dynamic UserDetails, bool isPassword)
22   - {
23   - ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  22 + {
  23 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
24 24 logger.Debug("inside SendEmail in for isPassword =" + isPassword);
25 25  
26 26 try
... ... @@ -36,7 +36,7 @@ namespace AIAHTML5.API.Models
36 36 string userName = string.Empty;
37 37 string fName = string.Empty;
38 38 string lName = string.Empty;
39   - string site_url = Convert.ToString(ConfigurationManager.AppSettings["Site_URL"]);
  39 + string site_url = Convert.ToString(ConfigurationManager.AppSettings["Site_URL"]);
40 40 bool isAdminRequest = false;
41 41  
42 42 foreach (KeyValuePair<string, object> kvp in UserDetails)
... ... @@ -53,8 +53,8 @@ namespace AIAHTML5.API.Models
53 53 if (kvp.Key == "lastName")
54 54 lName = kvp.Value.ToString();
55 55  
56   - if(kvp.Key == "admin")
57   - isAdminRequest = true;
  56 + if (kvp.Key == "isAdmin")
  57 + isAdminRequest = Convert.ToBoolean(kvp.Value);
58 58 }
59 59  
60 60 string fullName = fName + " " + lName;
... ... @@ -64,24 +64,29 @@ namespace AIAHTML5.API.Models
64 64 string templatePath = string.Empty;
65 65 string resetPasswordLink = string.Empty;
66 66  
67   - if (isPassword)
  67 + if (isAdminRequest)
68 68 {
69   - templatePath = "~/Templates/forgot-Password.html";
70   - resetPasswordLink = site_url + "?em:" + HttpUtility.UrlEncode(userMail);
  69 + templatePath = "~/Templates/admin-Request.html";
71 70 }
72 71 else
73   - templatePath = "~/Templates/forgot-UserId.html";
74   -
75   - if(isAdminRequest)
76   - templatePath = "~/Templates/admin-Request.html";
77   -
  72 + {
  73 + if (isPassword)
  74 + {
  75 + templatePath = "~/Templates/forgot-Password.html";
  76 + resetPasswordLink = site_url + "?em:" + HttpUtility.UrlEncode(userMail);
  77 + }
  78 + else
  79 + templatePath = "~/Templates/forgot-UserId.html";
  80 + }
  81 +
  82 +
78 83 logger.Debug("inside SendEmail for templatePath= " + templatePath + ", userId= " + userId + ", userMail= " + userMail + ",fullName= " + fullName + ",resetPasswordLink= " + resetPasswordLink);
79 84 string mailBody = UserUtility.GetMailBodyTextFromTemplate(templatePath, userId, userMail, fullName, resetPasswordLink);
80 85  
81 86 lstToAddress.Add(userMail);
82 87  
83   - emailText = mailBody;
84   -
  88 + emailText = mailBody;
  89 +
85 90 logger.Debug("emailText= " + emailText);
86 91 // for embedding images in email
87 92 if (emailText.Contains("<img"))
... ... @@ -100,14 +105,17 @@ namespace AIAHTML5.API.Models
100 105 }
101 106  
102 107 string mailSubject = string.Empty;
103   - if(!isPassword)
104   - mailSubject = "UserID recovery mail for: ";
  108 + if (isAdminRequest)
  109 + mailSubject = "'Admin' request for: ";
105 110 else
106   - mailSubject = "Password recovery mail for: ";
107   -
108   - if (isAdminRequest)
109   - mailSubject = "Administrator request for: ";
110   -
  111 + {
  112 + if (!isPassword)
  113 + mailSubject = "UserID recovery mail for: ";
  114 + else
  115 + mailSubject = "Password recovery mail for: ";
  116 + }
  117 +
  118 +
111 119 emailUtility.sHostName = Convert.ToString(ConfigurationManager.AppSettings["HostAddress"]);
112 120 emailUtility.sFromAddress = Convert.ToString(ConfigurationManager.AppSettings["SenderEmailAddress"]);
113 121 emailUtility.bIsBodyHtml = true;
... ... @@ -129,8 +137,8 @@ namespace AIAHTML5.API.Models
129 137 }
130 138  
131 139 protected static string GetMailBodyTextFromTemplate(string templatePath, string userId, string userMail, string fullName, string resetPasswordUrl)
132   - {
133   - ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  140 + {
  141 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
134 142 logger.Debug("inside GetMailBodyTextFromTemplate for templatePath= " + templatePath + ", userId= " + userId + ", userMail= " + userMail + ",fullName= " + fullName + ",resetPasswordLink= " + resetPasswordUrl);
135 143  
136 144 string fileToRead = string.Empty;
... ... @@ -155,10 +163,203 @@ namespace AIAHTML5.API.Models
155 163 }
156 164 catch (Exception e)
157 165 {
158   - emailBody = "Exception: " + e.Message;
  166 + emailBody = "Exception: " + e.Message;
159 167 logger.Fatal("exception in GetMailBodyTextFromTemplate. msg= " + e.Message + ", stacktrace= " + e.StackTrace);
160 168 }
161 169 return emailBody;
162 170 }
  171 +
  172 + public static bool SendAdminRequestEmail(dynamic UserDetails, bool isAdmin)
  173 + {
  174 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  175 + logger.Debug("inside SendEmail in for isAdmin =" + isAdmin);
  176 +
  177 + try
  178 + {
  179 + List<LinkedResource> lstLinkedResource = new List<LinkedResource>();
  180 + EmailUtility emailUtility = new EmailUtility();
  181 + List<string> lstToAddress = new List<string>();
  182 + List<string> lstBccAddress = new List<string>();
  183 +
  184 + string emailText = string.Empty;
  185 + string userId = string.Empty;
  186 + string userMail = string.Empty;
  187 + string userName = string.Empty;
  188 + string fName = string.Empty;
  189 + string lName = string.Empty;
  190 + string site_url = Convert.ToString(ConfigurationManager.AppSettings["Site_URL"]);
  191 +
  192 + foreach (KeyValuePair<string, object> kvp in UserDetails)
  193 + {
  194 + if (kvp.Key == "loginId")
  195 + userId = kvp.Value.ToString();
  196 +
  197 + if (kvp.Key == "emailId")
  198 + userMail = kvp.Value.ToString();
  199 +
  200 + if (kvp.Key == "firstName")
  201 + fName = kvp.Value.ToString();
  202 +
  203 + if (kvp.Key == "lastName")
  204 + lName = kvp.Value.ToString();
  205 + }
  206 +
  207 + string fullName = fName + " " + lName;
  208 +
  209 + string logoPath = HttpContext.Current.Server.MapPath("~/content/images/logo.png");
  210 +
  211 + string templatePath = string.Empty;
  212 + string resetPasswordLink = string.Empty;
  213 +
  214 + if (isAdmin)
  215 + {
  216 + templatePath = "~/Templates/admin-Request.html";
  217 + }
  218 +
  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, "");
  221 +
  222 + lstToAddress.Add(userMail);
  223 +
  224 + emailText = mailBody;
  225 +
  226 + logger.Debug("emailText= " + emailText);
  227 + // for embedding images in email
  228 + if (emailText.Contains("<img"))
  229 + {
  230 + LinkedResource linkedLogo = new LinkedResource(logoPath, MediaTypeNames.Image.Jpeg);
  231 + linkedLogo.ContentId = "AIA_Logo_Image";
  232 + linkedLogo.TransferEncoding = TransferEncoding.Base64;
  233 + emailText = emailText.Replace("{logoPath}", "cid:" + linkedLogo.ContentId);
  234 + lstLinkedResource.Add(linkedLogo);
  235 + }
  236 +
  237 + emailUtility.sAlternateView = AlternateView.CreateAlternateViewFromString(emailText, null, "text/html");
  238 + foreach (var sItem in lstLinkedResource)
  239 + {
  240 + emailUtility.sAlternateView.LinkedResources.Add(sItem);
  241 + }
  242 +
  243 + string mailSubject = string.Empty;
  244 + if (isAdmin)
  245 + mailSubject = "'Admin' access request for account: ";
  246 +
  247 +
  248 + emailUtility.sHostName = Convert.ToString(ConfigurationManager.AppSettings["HostAddress"]);
  249 + emailUtility.sFromAddress = Convert.ToString(ConfigurationManager.AppSettings["SenderEmailAddress"]);
  250 + emailUtility.bIsBodyHtml = true;
  251 + emailUtility.bEnableSsl = false;
  252 + emailUtility.sSubject = mailSubject + userMail;
  253 + //sEmailUtility.sBodyText = sEmailText;
  254 + emailUtility.iPort = 25;
  255 + emailUtility.sToAddresses = lstToAddress;
  256 + emailUtility.sBccAddresses = lstBccAddress;
  257 +
  258 + emailUtility.SendSmtpEmail();
  259 + return true;
  260 + }
  261 + catch (Exception ex)
  262 + {
  263 + string message = "Exception: " + ex.Message;
  264 + return false;
  265 + }
  266 + }
  267 +
  268 + public static bool SendAdminRequestEmail(Newtonsoft.Json.Linq.JObject userInfo)
  269 + {
  270 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  271 + logger.Debug("inside SendEmail in for isAdmin =" + userInfo["isAdmin"]);
  272 +
  273 + try
  274 + {
  275 + List<LinkedResource> lstLinkedResource = new List<LinkedResource>();
  276 + EmailUtility emailUtility = new EmailUtility();
  277 + List<string> lstToAddress = new List<string>();
  278 + List<string> lstBccAddress = new List<string>();
  279 +
  280 + string emailText = string.Empty;
  281 + string userId = string.Empty;
  282 + string userMail = string.Empty;
  283 + string userName = string.Empty;
  284 + string fullName = string.Empty;
  285 + string message = string.Empty;
  286 + bool isAdmin = false;
  287 +
  288 + string site_url = Convert.ToString(ConfigurationManager.AppSettings["Site_URL"]);
  289 +
  290 + string[] mailToArr = (ConfigurationManager.AppSettings["AdminSupportStaff"]).Split(',');
  291 + for(int i=0; i<mailToArr.Length; i++)
  292 + {
  293 + lstToAddress.Add(mailToArr[i].ToString());
  294 + }
  295 +
  296 + fullName = userInfo["firstName"].ToString() + " " + userInfo["lastName"].ToString();
  297 + userMail = userInfo["emailId"].ToString();
  298 + message = userInfo["userMessage"].ToString();
  299 + isAdmin = Convert.ToBoolean(userInfo["isAdmin"]);
  300 +
  301 + string logoPath = HttpContext.Current.Server.MapPath("~/content/images/logo.png");
  302 +
  303 + string templatePath = string.Empty;
  304 + string resetPasswordLink = string.Empty;
  305 +
  306 + //if (isAdmin)
  307 + //{
  308 + // templatePath = "~/Templates/admin-Request.html";
  309 + //}
  310 +
  311 + //logger.Debug("inside SendEmail for templatePath= " + templatePath + ", userId= " + userId + ", userMail= " + userMail + ",fullName= " + fullName + ",resetPasswordLink= " + resetPasswordLink);
  312 + //string mailBody = UserUtility.GetMailBodyTextFromTemplate(templatePath, userId, userMail, fullName, "");
  313 +
  314 + //if (!string.IsNullOrEmpty(message))
  315 + // mailBody = mailBody.Replace("{usermessage}", message);
  316 +
  317 + lstToAddress.Add(userMail);
  318 +
  319 + //emailText = mailBody;
  320 + emailText = message; // +"<br/><br/>";
  321 +
  322 + logger.Debug("emailText= " + emailText);
  323 + // for embedding images in email
  324 + if (emailText.Contains("<img"))
  325 + {
  326 + LinkedResource linkedLogo = new LinkedResource(logoPath, MediaTypeNames.Image.Jpeg);
  327 + linkedLogo.ContentId = "AIA_Logo_Image";
  328 + linkedLogo.TransferEncoding = TransferEncoding.Base64;
  329 + emailText = emailText.Replace("{logoPath}", "cid:" + linkedLogo.ContentId);
  330 + lstLinkedResource.Add(linkedLogo);
  331 + }
  332 +
  333 + emailUtility.sAlternateView = AlternateView.CreateAlternateViewFromString(emailText, null, "text/html");
  334 + foreach (var sItem in lstLinkedResource)
  335 + {
  336 + emailUtility.sAlternateView.LinkedResources.Add(sItem);
  337 + }
  338 +
  339 + string mailSubject = string.Empty;
  340 + if (isAdmin)
  341 + mailSubject = "'Admin' access request for account: ";
  342 +
  343 +
  344 + emailUtility.sHostName = Convert.ToString(ConfigurationManager.AppSettings["HostAddress"]);
  345 + emailUtility.sFromAddress = Convert.ToString(ConfigurationManager.AppSettings["SenderEmailAddress"]);
  346 + emailUtility.bIsBodyHtml = true;
  347 + emailUtility.bEnableSsl = false;
  348 + emailUtility.sSubject = mailSubject + userMail;
  349 + //sEmailUtility.sBodyText = sEmailText;
  350 + emailUtility.iPort = 25;
  351 + emailUtility.sToAddresses = lstToAddress;
  352 + emailUtility.sBccAddresses = lstBccAddress;
  353 +
  354 + emailUtility.SendSmtpEmail();
  355 + return true;
  356 + }
  357 + catch (Exception ex)
  358 + {
  359 + string message = "Exception: " + ex.Message;
  360 + return false;
  361 + }
  362 + }
  363 +
163 364 }
164 365 }
165 366 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Templates/admin-Request.html
... ... @@ -16,7 +16,7 @@
16 16 <table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>
17 17 <tbody>
18 18 <tr>
19   - <td colspan='2' style=' font-size:32px; font-weight:bold; color:#fff; font-family:Gotham, Helvetica, Arial, sans-serif'>Admin Access Request</td>
  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 20 </tr>
21 21 <tr>
22 22 <td colspan='2'>&nbsp;</td>
... ... @@ -34,7 +34,13 @@
34 34 <td colspan='2'>&nbsp;</td>
35 35 </tr>
36 36 <tr>
37   - <td colspan='2' style=' font-size:18px; font-family:Gotham, Helvetica, Arial, sans-serif; color:#fff;'>Your request has been registered and intimated to referenced authority. </td>
  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>
38 44 </tr>
39 45 <tr>
40 46 <td colspan='2'>&nbsp;</td>
... ...
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll
No preview for this file type
400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj
... ... @@ -52,6 +52,7 @@
52 52 <Content Include="app\controllers\LabExercController.js" />
53 53 <Content Include="app\main\AIA.js" />
54 54 <Content Include="app\main\Link.js" />
  55 + <Content Include="app\services\AdminService.js" />
55 56 <Content Include="app\services\AuthenticationService.js" />
56 57 <Content Include="app\services\DataService.js" />
57 58 <Content Include="app\utility\BitmapData.js" />
... ...
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",
4   -function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants, UserModules, LoginMessageConstants) {
  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) {
5 5  
6 6 //$scope.pageToOpen = {
7 7 // name: 'MainMenu'
... ... @@ -78,7 +78,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
78 78 emailId: null,
79 79 isPassword: null,
80 80 newPassword: null,
81   - confirmPassword: null
  81 + confirmPassword: null,
  82 + isAdmin: null,
  83 + userMessage: null
82 84 };
83 85 $rootScope.userData;
84 86 $rootScope.userModules;
... ... @@ -3310,87 +3312,30 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3310 3312 }
3311 3313  
3312 3314 $rootScope.OpenAdminForm = function (userInfo) {
3313   - getUserDetails();
3314   - if ($rootScope.userData) {
3315   - $('#fName').val(userInfo.firstName);
3316   - $('#lName').val(userInfo.lastName);
3317   - $('#email').val(userInfo.emailId);
3318   - }
3319   - /*$('#testFormAdmin').attr('display', 'block');
3320   - $('#testFormAdmin').toggle();*/
3321   - userInfo.firstName = 'Utkarsh';
3322   - userInfo.lastName = 'Singh';
3323   - userInfo.emailId = 'utkarsh.singh@ebix.com';
3324 3315  
3325   - if ((userInfo.emailId != null) && (userInfo.emailId != '')) {
3326   - if (validateEmail(userInfo.emailId)) {
3327   - isMailForPassword = 'admin';
3328   -
3329   - AuthenticationService.SendMailToUser(userInfo)
3330   - .then(function (result) {
3331   - if (result == LoginConstants.USER_NOT_FOUND) {
3332   - $rootScope.errorMassage = LoginMessageConstants.INCORRECT_EMAIL_ID;
3333   - $("#messageModal").modal('show');
3334   - }
3335   - else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) {
3336   - $rootScope.errorMassage = LoginMessageConstants.ERROR_IN_FECTHING_DETAILS;
3337   - $("#messageModal").modal('show');
3338   - }
3339   - else if (result == LoginConstants.MAIL_NOT_SENT) {
3340   - $rootScope.errorMassage = LoginMessageConstants.MAIL_NOT_SENT;
3341   - $("#messageModal").modal('show');
3342   - }
3343   - else {
3344   - if (result.loginId != undefined || result.loginId != "" || result.loginId != null) {
3345   - var message;
3346   - if ($('.forgot-sm').length > 0) {
3347   - $('.forgot-sm').fadeOut();
3348   - $('.forgot-sm').modal('hide');
3349   - }
3350   - if ($('.forgot-sm1').length > 0) {
3351   - $('.forgot-sm1').fadeOut();
3352   - $('.forgot-sm1').modal('hide');
3353   - }
3354   - if (isMailForPassword)
3355   - message = LoginMessageConstants.RESET_PASSWORD;
3356   - else
3357   - message = LoginMessageConstants.USERID_SENT_IN_EMAIL
3358   - //alert(message);
3359   - $rootScope.errorMassage = message;
3360   - $("#messageModal").modal('show');
3361   -
3362   -
3363   - }
3364   - }
  3316 + //if ($rootScope.userData) {
  3317 + $('#fName').val('Utkarsh');
  3318 + $('#lName').val('Singh');
  3319 + $('#emailId').val('utkarsh.singh@ebix.com');
  3320 + //}
  3321 + };
3365 3322  
3366   - },
3367   - function (error) {
3368   - console.log(' Error in authentication = ' + error.statusText);
3369   - // alert(LoginConstants.ERROR_IN_FECTHING_DETAILS);
3370   - $rootScope.errorMassage = LoginConstants.ERROR_IN_FECTHING_DETAILS;
3371   - $("#messageModal").modal('show');
3372   - });
3373   - }
3374   - else {
3375   - // alert(LoginMessageConstants.INCORRECT_EMAIL_ID);
3376   - $rootScope.errorMassage = LoginMessageConstants.INCORRECT_EMAIL_ID;
3377   - $("#messageModal").modal('show');
3378   - }
  3323 + $rootScope.SendAdminAccessRequestMail = function (userInfo) {
  3324 + userInfo.isAdmin = true;
  3325 + if ($rootScope.userData) {
3379 3326 }
3380   - else {
3381   - //alert(LoginMessageConstants.BLANK_EMAIL_ID);
3382   - $rootScope.errorMassage = LoginMessageConstants.BLANK_EMAIL_ID;
3383   - $("#messageModal").modal('show');
3384 3327  
3385   - }
3386   - };
  3328 + userInfo.firstName = "Utkarsh";
  3329 + userInfo.lastName = "Singh";
  3330 + userInfo.emailId = "utkarsh.singh@ebix.com";
  3331 + var msg = $('#userMessage').text();
  3332 + if (userInfo.userMessage==null)
  3333 + userInfo.userMessage = msg;
3387 3334  
3388   - /*function SendMailFromAdmin(userInfo, isMailForPassword) {
3389 3335 if ((userInfo.emailId != null) && (userInfo.emailId != '')) {
3390 3336 if (validateEmail(userInfo.emailId)) {
3391   - isMailForPassword = 'admin';
3392 3337  
3393   - AuthenticationService.SendMailToUser(userInfo)
  3338 + AdminService.SendAdminRequestMail(userInfo)
3394 3339 .then(function (result) {
3395 3340 if (result == LoginConstants.USER_NOT_FOUND) {
3396 3341 $rootScope.errorMassage = LoginMessageConstants.INCORRECT_EMAIL_ID;
... ... @@ -3415,9 +3360,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3415 3360 $('.forgot-sm1').fadeOut();
3416 3361 $('.forgot-sm1').modal('hide');
3417 3362 }
3418   - if (isMailForPassword)
3419   - message = LoginMessageConstants.RESET_PASSWORD;
3420   - else
  3363 + //if (isMailForPassword)
  3364 + // message = LoginMessageConstants.RESET_PASSWORD;
  3365 + //else
3421 3366 message = LoginMessageConstants.USERID_SENT_IN_EMAIL
3422 3367 //alert(message);
3423 3368 $rootScope.errorMassage = message;
... ... @@ -3447,7 +3392,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3447 3392 $("#messageModal").modal('show');
3448 3393  
3449 3394 }
3450   - };*/
  3395 + };
3451 3396  
3452 3397 }]
3453 3398 );
3454 3399 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/app/services/AdminService.js 0 → 100644
  1 +AIA.factory('AdminService', function ($http, $q) {
  2 + return {
  3 + SendAdminRequestMail: function (userInfo) {
  4 + var deferred = $q.defer();
  5 +
  6 + $http.post('/API/api/AdminAccess', userInfo, { //JSON.stringify(userEmail)
  7 + headers: {
  8 + 'Content-Type': 'application/json'
  9 + }
  10 + })
  11 + .success(function (data, status, headers, config) {
  12 + console.log('success');
  13 + deferred.resolve(data);
  14 + }).error(function (data, status, headers, config) {
  15 + console.log('error')
  16 + deferred.reject(status);
  17 + });
  18 + return deferred.promise;
  19 + }
  20 + }
  21 +});
0 22 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html
... ... @@ -89,3 +89,4 @@
89 89 </div>
90 90  
91 91 </div>
  92 +<script src="app/services/AdminService.js"></script>
92 93 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/index.html
... ... @@ -1177,26 +1177,26 @@
1177 1177 <div class="form-group">
1178 1178 <div class="input-group">
1179 1179 <span class="input-group-addon"><i class="fa fa-user"></i></span>
1180   - <input id="fName" class="form-control" placeholder="" type="text" ng-bind="userInfo.firstName" ng-readonly="true">
  1180 + <input id="fName" class="form-control" placeholder="" type="text" ng-model="userInfo.firstName" ng-readonly="true">
1181 1181 </div>
1182 1182 <div class="input-group">
1183 1183 <span class="input-group-addon"><i class="fa fa-user"></i></span>
1184   - <input id="lName" class="form-control" placeholder="" type="text" ng-bind="userInfo.lastName" ng-readonly="true">
  1184 + <input id="lName" class="form-control" placeholder="" type="text" ng-model="userInfo.lastName" ng-readonly="true">
1185 1185 </div>
1186 1186 <div class="input-group">
1187 1187 <span class="input-group-addon"><i class="fa fa-envelope"></i></span>
1188   - <input id="fName" class="form-control" placeholder="" type="text" ng-bind="userInfo.emailId" ng-readonly="true">
  1188 + <input id="emailId" class="form-control" placeholder="" type="text" ng-model="userInfo.emailId" ng-readonly="true">
1189 1189 </div>
1190 1190 <div class="input-group">
1191 1191 <span class="input-group-addon"><i class="fa fa-envelope"></i></span>
1192   - <input id="message" class="form-control" type="text">
  1192 + <input id="userMessage" ng-model="userInfo.userMessage" class="form-control" type="text">
1193 1193 </div>
1194 1194 </div>
1195 1195 </form>
1196 1196 </div>
1197 1197 <div class="modal-footer">
1198   - <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1199   - <button type="button" class="btn btn-primary">Save changes</button>
  1198 + <button type="button" ng-click="SendAdminAccessRequestMail(userInfo)" class="btn btn-primary">Submit</button>
  1199 + <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1200 1200 </div>
1201 1201 </div>
1202 1202 </div>
... ... @@ -1331,6 +1331,7 @@
1331 1331 <script src="app/controllers/HomeController.js"></script>
1332 1332 <script src="app/controllers/LinkController.js"></script>
1333 1333 <script src="app/services/AuthenticationService.js"></script>
  1334 + <script src="app/services/AdminService.js"></script>
1334 1335  
1335 1336 <script src="app/services/DataService.js"></script>
1336 1337 <script src="libs/jquery/jquery_plugin/jqueryui.js"></script>
... ...