Commit 5526158aeebcba4be694ee6fbfe5267638444ed0
Merge branch 'US_15245_15885' into Develop
Showing
15 changed files
with
279 additions
and
46 deletions
400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj
@@ -106,13 +106,14 @@ | @@ -106,13 +106,14 @@ | ||
106 | <ItemGroup> | 106 | <ItemGroup> |
107 | <Compile Include="App_Start\WebApiConfig.cs" /> | 107 | <Compile Include="App_Start\WebApiConfig.cs" /> |
108 | <Compile Include="Constants\AIAConstants.cs" /> | 108 | <Compile Include="Constants\AIAConstants.cs" /> |
109 | + <Compile Include="Controllers\AdminAccessController.cs" /> | ||
109 | <Compile Include="Controllers\AuthenticateController.cs" /> | 110 | <Compile Include="Controllers\AuthenticateController.cs" /> |
110 | <Compile Include="Controllers\ForgotUserController.cs" /> | 111 | <Compile Include="Controllers\ForgotUserController.cs" /> |
111 | <Compile Include="Controllers\ResetPasswordController.cs" /> | 112 | <Compile Include="Controllers\ResetPasswordController.cs" /> |
112 | <Compile Include="Global.asax.cs"> | 113 | <Compile Include="Global.asax.cs"> |
113 | <DependentUpon>Global.asax</DependentUpon> | 114 | <DependentUpon>Global.asax</DependentUpon> |
114 | </Compile> | 115 | </Compile> |
115 | - <Compile Include="Models\ResetUser.cs" /> | 116 | + <Compile Include="Models\UserUtility.cs" /> |
116 | <Compile Include="Models\Users.cs" /> | 117 | <Compile Include="Models\Users.cs" /> |
117 | <Compile Include="Properties\AssemblyInfo.cs" /> | 118 | <Compile Include="Properties\AssemblyInfo.cs" /> |
118 | <Compile Include="Properties\Settings.Designer.cs"> | 119 | <Compile Include="Properties\Settings.Designer.cs"> |
400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs
@@ -10,7 +10,7 @@ namespace AIAHTML5.API.Constants | @@ -10,7 +10,7 @@ namespace AIAHTML5.API.Constants | ||
10 | public const string ERROR_IN_FECTHING_DETAILS = "Error in fecthing details."; | 10 | public const string ERROR_IN_FECTHING_DETAILS = "Error in fecthing details."; |
11 | public const string USER_NOT_FOUND = "User not found."; | 11 | public const string USER_NOT_FOUND = "User not found."; |
12 | public const string MAIL_NOT_SENT = "Mail not sent."; | 12 | public const string MAIL_NOT_SENT = "Mail not sent."; |
13 | - | 13 | + public const string MAIL_SENT = "Mail sent."; |
14 | 14 | ||
15 | 15 | ||
16 | } | 16 | } |
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 | + public HttpResponseMessage Post([FromBody]JObject userInfo) | ||
19 | + { | ||
20 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | ||
21 | + | ||
22 | + bool isMailSent = AIAHTML5.API.Models.UserUtility.SendAdminRequestEmail(userInfo); | ||
23 | + | ||
24 | + if (isMailSent) | ||
25 | + { | ||
26 | + logger.Debug("AdminAccessRequest mail sent for User: " + userInfo["firstName"] + " " + userInfo["lastName"] + "& mail id = " + userInfo["emailId"]); | ||
27 | + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MAIL_SENT) }; | ||
28 | + } | ||
29 | + else | ||
30 | + { | ||
31 | + logger.Debug("AdminAccessRequest mail sent for User: " + userInfo["firstName"] + " " + userInfo["lastName"] + "& mail id = " + userInfo["emailId"]); | ||
32 | + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MAIL_NOT_SENT) }; | ||
33 | + } | ||
34 | + } | ||
35 | + } | ||
36 | +} | ||
0 | \ No newline at end of file | 37 | \ No newline at end of file |
400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs
@@ -45,17 +45,17 @@ namespace AIAHTML5.API.Controllers | @@ -45,17 +45,17 @@ namespace AIAHTML5.API.Controllers | ||
45 | 45 | ||
46 | logger.Debug("1. inside if in ForgotUserController userDetails= " + userDetails); | 46 | logger.Debug("1. inside if in ForgotUserController userDetails= " + userDetails); |
47 | 47 | ||
48 | - if (Convert.ToBoolean(userInfo["isPassword"])) | 48 | + if (Convert.ToBoolean(userInfo["havePassword"])) |
49 | { | 49 | { |
50 | - logger.Debug("2. isPassword= " + Convert.ToBoolean(userInfo["isPassword"])); | 50 | + logger.Debug("2. havePassword= " + Convert.ToBoolean(userInfo["havePassword"])); |
51 | 51 | ||
52 | - isMailSent = AIAHTML5.API.Models.ResetUser.SendEmail(userData, true); | 52 | + isMailSent = AIAHTML5.API.Models.UserUtility.SendEmail(userData, true); |
53 | } | 53 | } |
54 | else | 54 | else |
55 | { | 55 | { |
56 | - logger.Debug("3. isPassword= " + Convert.ToBoolean(userInfo["isPassword"])); | 56 | + logger.Debug("3. havePassword= " + Convert.ToBoolean(userInfo["havePassword"])); |
57 | 57 | ||
58 | - isMailSent = AIAHTML5.API.Models.ResetUser.SendEmail(userData, false); | 58 | + isMailSent = AIAHTML5.API.Models.UserUtility.SendEmail(userData, false); |
59 | } | 59 | } |
60 | logger.Debug("isMailSent= " + isMailSent); | 60 | logger.Debug("isMailSent= " + isMailSent); |
61 | if (isMailSent) | 61 | if (isMailSent) |
400-SOURCECODE/AIAHTML5.API/Models/ResetUser.cs renamed to 400-SOURCECODE/AIAHTML5.API/Models/UserUtility.cs
@@ -12,16 +12,16 @@ using AIAHTML5.API.Utility; | @@ -12,16 +12,16 @@ using AIAHTML5.API.Utility; | ||
12 | using System.Text; | 12 | using System.Text; |
13 | using System.IO; | 13 | using System.IO; |
14 | using System.Net.Mime; | 14 | using System.Net.Mime; |
15 | -using System.Configuration; | 15 | +using System.Configuration; |
16 | 16 | ||
17 | namespace AIAHTML5.API.Models | 17 | namespace AIAHTML5.API.Models |
18 | { | 18 | { |
19 | - public class ResetUser | 19 | + public class UserUtility |
20 | { | 20 | { |
21 | - public static bool SendEmail(dynamic UserDetails, bool isPassword) | ||
22 | - { | ||
23 | - ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | ||
24 | - logger.Debug("inside SendEmail in for isPassword =" + isPassword); | 21 | + public static bool SendEmail(dynamic UserDetails, bool havePassword) |
22 | + { | ||
23 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | ||
24 | + logger.Debug("inside SendEmail in for isPassword =" + havePassword); | ||
25 | 25 | ||
26 | try | 26 | try |
27 | { | 27 | { |
@@ -38,19 +38,19 @@ namespace AIAHTML5.API.Models | @@ -38,19 +38,19 @@ namespace AIAHTML5.API.Models | ||
38 | string lName = string.Empty; | 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 | ||
41 | - foreach (KeyValuePair<string, object> kvp in UserDetails) | 41 | + foreach (KeyValuePair<string, object> userObj in UserDetails) |
42 | { | 42 | { |
43 | - if (kvp.Key == "loginId") | ||
44 | - userId = kvp.Value.ToString(); | 43 | + if (userObj.Key == "loginId") |
44 | + userId = userObj.Value.ToString(); | ||
45 | 45 | ||
46 | - if (kvp.Key == "emailId") | ||
47 | - userMail = kvp.Value.ToString(); | 46 | + if (userObj.Key == "emailId") |
47 | + userMail = userObj.Value.ToString(); | ||
48 | 48 | ||
49 | - if (kvp.Key == "firstName") | ||
50 | - fName = kvp.Value.ToString(); | 49 | + if (userObj.Key == "firstName") |
50 | + fName = userObj.Value.ToString(); | ||
51 | 51 | ||
52 | - if (kvp.Key == "lastName") | ||
53 | - lName = kvp.Value.ToString(); | 52 | + if (userObj.Key == "lastName") |
53 | + lName = userObj.Value.ToString(); | ||
54 | } | 54 | } |
55 | 55 | ||
56 | string fullName = fName + " " + lName; | 56 | string fullName = fName + " " + lName; |
@@ -60,21 +60,21 @@ namespace AIAHTML5.API.Models | @@ -60,21 +60,21 @@ namespace AIAHTML5.API.Models | ||
60 | string templatePath = string.Empty; | 60 | string templatePath = string.Empty; |
61 | string resetPasswordLink = string.Empty; | 61 | string resetPasswordLink = string.Empty; |
62 | 62 | ||
63 | - if (isPassword) | 63 | + if (havePassword) |
64 | { | 64 | { |
65 | templatePath = "~/Templates/forgot-Password.html"; | 65 | templatePath = "~/Templates/forgot-Password.html"; |
66 | resetPasswordLink = site_url + "?em:" + HttpUtility.UrlEncode(userMail); | 66 | resetPasswordLink = site_url + "?em:" + HttpUtility.UrlEncode(userMail); |
67 | } | 67 | } |
68 | else | 68 | else |
69 | - templatePath = "~/Templates/forgot-UserId.html"; | ||
70 | - | 69 | + templatePath = "~/Templates/forgot-UserId.html"; |
70 | + | ||
71 | logger.Debug("inside SendEmail for templatePath= " + templatePath + ", userId= " + userId + ", userMail= " + userMail + ",fullName= " + fullName + ",resetPasswordLink= " + resetPasswordLink); | 71 | logger.Debug("inside SendEmail for templatePath= " + templatePath + ", userId= " + userId + ", userMail= " + userMail + ",fullName= " + fullName + ",resetPasswordLink= " + resetPasswordLink); |
72 | - string mailBody = ResetUser.GetMailBodyTextFromTemplate(templatePath, userId, userMail, fullName, resetPasswordLink); | 72 | + string mailBody = UserUtility.GetMailBodyTextFromTemplate(templatePath, userId, userMail, fullName, resetPasswordLink); |
73 | 73 | ||
74 | lstToAddress.Add(userMail); | 74 | lstToAddress.Add(userMail); |
75 | 75 | ||
76 | - emailText = mailBody; | ||
77 | - | 76 | + emailText = mailBody; |
77 | + | ||
78 | logger.Debug("emailText= " + emailText); | 78 | logger.Debug("emailText= " + emailText); |
79 | // for embedding images in email | 79 | // for embedding images in email |
80 | if (emailText.Contains("<img")) | 80 | if (emailText.Contains("<img")) |
@@ -93,17 +93,17 @@ namespace AIAHTML5.API.Models | @@ -93,17 +93,17 @@ namespace AIAHTML5.API.Models | ||
93 | } | 93 | } |
94 | 94 | ||
95 | string mailSubject = string.Empty; | 95 | string mailSubject = string.Empty; |
96 | - if(!isPassword) | 96 | + if (!havePassword) |
97 | mailSubject = "UserID recovery mail for: "; | 97 | mailSubject = "UserID recovery mail for: "; |
98 | else | 98 | else |
99 | - mailSubject = "Password recovery mail for: "; | ||
100 | - | 99 | + mailSubject = "Password recovery mail for: "; |
100 | + | ||
101 | + | ||
101 | emailUtility.sHostName = Convert.ToString(ConfigurationManager.AppSettings["HostAddress"]); | 102 | emailUtility.sHostName = Convert.ToString(ConfigurationManager.AppSettings["HostAddress"]); |
102 | emailUtility.sFromAddress = Convert.ToString(ConfigurationManager.AppSettings["SenderEmailAddress"]); | 103 | emailUtility.sFromAddress = Convert.ToString(ConfigurationManager.AppSettings["SenderEmailAddress"]); |
103 | emailUtility.bIsBodyHtml = true; | 104 | emailUtility.bIsBodyHtml = true; |
104 | emailUtility.bEnableSsl = false; | 105 | emailUtility.bEnableSsl = false; |
105 | emailUtility.sSubject = mailSubject + userMail; | 106 | emailUtility.sSubject = mailSubject + userMail; |
106 | - //sEmailUtility.sBodyText = sEmailText; | ||
107 | emailUtility.iPort = 25; | 107 | emailUtility.iPort = 25; |
108 | emailUtility.sToAddresses = lstToAddress; | 108 | emailUtility.sToAddresses = lstToAddress; |
109 | emailUtility.sBccAddresses = lstBccAddress; | 109 | emailUtility.sBccAddresses = lstBccAddress; |
@@ -119,9 +119,9 @@ namespace AIAHTML5.API.Models | @@ -119,9 +119,9 @@ namespace AIAHTML5.API.Models | ||
119 | } | 119 | } |
120 | 120 | ||
121 | protected static string GetMailBodyTextFromTemplate(string templatePath, string userId, string userMail, string fullName, string resetPasswordUrl) | 121 | protected static string GetMailBodyTextFromTemplate(string templatePath, string userId, string userMail, string fullName, string resetPasswordUrl) |
122 | - { | ||
123 | - ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | ||
124 | - logger.Debug("inside GetMailBodyTextFromTemplate for templatePath= " + templatePath + ", userId= " + userId + ", userMail= " + userMail + ",fullName= " + fullName + ",resetPasswordLink= " + resetPasswordUrl); | 122 | + { |
123 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | ||
124 | + logger.Debug("Inside GetMailBodyTextFromTemplate for templatePath= " + templatePath + ", userId= " + userId + ", userMail= " + userMail + ",fullName= " + fullName + ",resetPasswordLink= " + resetPasswordUrl); | ||
125 | 125 | ||
126 | string fileToRead = string.Empty; | 126 | string fileToRead = string.Empty; |
127 | string emailBody = string.Empty; | 127 | string emailBody = string.Empty; |
@@ -145,10 +145,67 @@ namespace AIAHTML5.API.Models | @@ -145,10 +145,67 @@ namespace AIAHTML5.API.Models | ||
145 | } | 145 | } |
146 | catch (Exception e) | 146 | catch (Exception e) |
147 | { | 147 | { |
148 | - emailBody = "Exception: " + e.Message; | 148 | + emailBody = "Exception: " + e.Message; |
149 | logger.Fatal("exception in GetMailBodyTextFromTemplate. msg= " + e.Message + ", stacktrace= " + e.StackTrace); | 149 | logger.Fatal("exception in GetMailBodyTextFromTemplate. msg= " + e.Message + ", stacktrace= " + e.StackTrace); |
150 | } | 150 | } |
151 | return emailBody; | 151 | return emailBody; |
152 | } | 152 | } |
153 | + | ||
154 | + public static bool SendAdminRequestEmail(Newtonsoft.Json.Linq.JObject userInfo) | ||
155 | + { | ||
156 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | ||
157 | + logger.Debug("Inside SendAdminRequestEmail for email =" + userInfo["emailId"]); | ||
158 | + | ||
159 | + try | ||
160 | + { | ||
161 | + EmailUtility emailUtility = new EmailUtility(); | ||
162 | + List<string> lstToAddress = new List<string>(); | ||
163 | + List<string> lstBccAddress = new List<string>(); | ||
164 | + | ||
165 | + string userMail = string.Empty; | ||
166 | + string fullName = string.Empty; | ||
167 | + string emailMessage = string.Empty; | ||
168 | + | ||
169 | + string[] mailToArr = (ConfigurationManager.AppSettings["AdminSupport"]).Split(','); | ||
170 | + if (mailToArr.Length > 0) | ||
171 | + { | ||
172 | + for (int i = 0; i < mailToArr.Length; i++) | ||
173 | + { | ||
174 | + lstToAddress.Add(mailToArr[i].ToString()); | ||
175 | + } | ||
176 | + } | ||
177 | + | ||
178 | + fullName = userInfo["firstName"].ToString() + " " + userInfo["lastName"].ToString(); | ||
179 | + userMail = userInfo["emailId"].ToString(); | ||
180 | + emailMessage = userInfo["userMessage"].ToString(); | ||
181 | + | ||
182 | + lstToAddress.Add(userMail); | ||
183 | + | ||
184 | + emailMessage = emailMessage.Replace("\n", "<br/>"); | ||
185 | + | ||
186 | + emailMessage += "<br/><br/>"; | ||
187 | + | ||
188 | + string mailSubject = "Admin Support request initiated for:"; | ||
189 | + | ||
190 | + emailUtility.sHostName = Convert.ToString(ConfigurationManager.AppSettings["HostAddress"]); | ||
191 | + emailUtility.sFromAddress = Convert.ToString(ConfigurationManager.AppSettings["SenderEmailAddress"]); | ||
192 | + emailUtility.bIsBodyHtml = true; | ||
193 | + emailUtility.bEnableSsl = false; | ||
194 | + emailUtility.sSubject = mailSubject + " " + userMail; | ||
195 | + emailUtility.sBodyText = emailMessage; | ||
196 | + emailUtility.iPort = 25; | ||
197 | + emailUtility.sToAddresses = lstToAddress; | ||
198 | + emailUtility.sBccAddresses = lstBccAddress; | ||
199 | + | ||
200 | + emailUtility.SendSmtpEmail(); | ||
201 | + return true; | ||
202 | + } | ||
203 | + catch (Exception ex) | ||
204 | + { | ||
205 | + logger.Fatal("exception in GetMailBodyTextFromTemplate. msg= " + ex.Message + ", stacktrace= " + ex.StackTrace); | ||
206 | + return false; | ||
207 | + } | ||
208 | + } | ||
209 | + | ||
153 | } | 210 | } |
154 | } | 211 | } |
155 | \ No newline at end of file | 212 | \ No newline at end of file |
400-SOURCECODE/AIAHTML5.API/Web.config
@@ -39,7 +39,8 @@ | @@ -39,7 +39,8 @@ | ||
39 | <add key="EnableSSL" value="false" /> | 39 | <add key="EnableSSL" value="false" /> |
40 | <add key="Site_Url" value ="//52.2.38.120"/> | 40 | <add key="Site_Url" value ="//52.2.38.120"/> |
41 | <add key ="HostAddress" value="10.100.12.13" /> | 41 | <add key ="HostAddress" value="10.100.12.13" /> |
42 | - <add key="isUserAuthenticated" value="false"/> | 42 | + <add key="isUserAuthenticated" value="True"/> |
43 | + <add key="AdminSupport" value=""/> | ||
43 | </appSettings> | 44 | </appSettings> |
44 | <system.web> | 45 | <system.web> |
45 | <compilation debug="true" targetFramework="4.5" /> | 46 | <compilation debug="true" targetFramework="4.5" /> |
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll
No preview for this file type
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config
@@ -39,7 +39,8 @@ | @@ -39,7 +39,8 @@ | ||
39 | <add key="EnableSSL" value="false" /> | 39 | <add key="EnableSSL" value="false" /> |
40 | <add key="Site_Url" value ="//52.2.38.120"/> | 40 | <add key="Site_Url" value ="//52.2.38.120"/> |
41 | <add key ="HostAddress" value="10.100.12.13" /> | 41 | <add key ="HostAddress" value="10.100.12.13" /> |
42 | - <add key="isUserAuthenticated" value="false"/> | 42 | + <add key="isUserAuthenticated" value="True"/> |
43 | + <add key="AdminSupport" value=""/> | ||
43 | </appSettings> | 44 | </appSettings> |
44 | <system.web> | 45 | <system.web> |
45 | <compilation debug="true" targetFramework="4.5" /> | 46 | <compilation debug="true" 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 | 'use strict'; | 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", "AdminConstants", "UserTypeConstants", |
4 | +function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants, UserModules, LoginMessageConstants, AdminService, AdminConstants, UserTypeConstants) { | ||
5 | 5 | ||
6 | //$scope.pageToOpen = { | 6 | //$scope.pageToOpen = { |
7 | // name: 'MainMenu' | 7 | // name: 'MainMenu' |
@@ -75,14 +75,16 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic | @@ -75,14 +75,16 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic | ||
75 | username: null, | 75 | username: null, |
76 | password: null, | 76 | password: null, |
77 | emailId: null, | 77 | emailId: null, |
78 | - isPassword: null, | 78 | + havePassword: null, |
79 | newPassword: null, | 79 | newPassword: null, |
80 | - confirmPassword: null | 80 | + confirmPassword: null, |
81 | + userMessage: null | ||
81 | }; | 82 | }; |
82 | $rootScope.userData; | 83 | $rootScope.userData; |
83 | $rootScope.userModules; | 84 | $rootScope.userModules; |
84 | $rootScope.errorMesaage; | 85 | $rootScope.errorMesaage; |
85 | $rootScope.isVisibleLogin; | 86 | $rootScope.isVisibleLogin; |
87 | + $rootScope.notAnAdmin; | ||
86 | var isfilloptionChecked = ""; | 88 | var isfilloptionChecked = ""; |
87 | var isOutlineOptionChecked = ""; | 89 | var isOutlineOptionChecked = ""; |
88 | $rootScope.initializeAIA = function () { | 90 | $rootScope.initializeAIA = function () { |
@@ -134,6 +136,13 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic | @@ -134,6 +136,13 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic | ||
134 | $rootScope.isVisibleLogin = false; | 136 | $rootScope.isVisibleLogin = false; |
135 | 137 | ||
136 | localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); | 138 | localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); |
139 | + | ||
140 | + var userType = result.userType + ''; | ||
141 | + | ||
142 | + if (userType === UserTypeConstants.SUPER_ADMIN) | ||
143 | + $rootScope.notAnAdmin = false; | ||
144 | + else | ||
145 | + $rootScope.notAnAdmin = true; | ||
137 | } | 146 | } |
138 | } | 147 | } |
139 | } | 148 | } |
@@ -193,9 +202,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic | @@ -193,9 +202,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic | ||
193 | if ((userInfo.emailId != null) && (userInfo.emailId != '')) { | 202 | if ((userInfo.emailId != null) && (userInfo.emailId != '')) { |
194 | if (validateEmail(userInfo.emailId)) { | 203 | if (validateEmail(userInfo.emailId)) { |
195 | if (isMailForPassword == true) | 204 | if (isMailForPassword == true) |
196 | - userInfo.isPassword = true; | 205 | + userInfo.havePassword = true; |
197 | else | 206 | else |
198 | - userInfo.isPassword = false; | 207 | + userInfo.havePassword = false; |
199 | 208 | ||
200 | AuthenticationService.SendMailToUser(userInfo) | 209 | AuthenticationService.SendMailToUser(userInfo) |
201 | .then(function (result) { | 210 | .then(function (result) { |
@@ -3287,5 +3296,45 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic | @@ -3287,5 +3296,45 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic | ||
3287 | 3296 | ||
3288 | } | 3297 | } |
3289 | 3298 | ||
3299 | + $rootScope.OpenAdminForm = function (userInfo) { | ||
3300 | + $('#adminModal').css({ top: '50px' }); | ||
3301 | + if ($rootScope.userData) { | ||
3302 | + $('#adminfName').val($rootScope.userData.firstName); | ||
3303 | + $('#adminlName').val($rootScope.userData.lastName); | ||
3304 | + $('#adminEmailId').val($rootScope.userData.emailId); | ||
3305 | + } | ||
3306 | + }; | ||
3307 | + | ||
3308 | + $rootScope.SendAdminAccessRequestMail = function (userInfo) { | ||
3309 | + | ||
3310 | + if ($rootScope.userData) { | ||
3311 | + userInfo.firstName = $rootScope.userData.firstName; | ||
3312 | + userInfo.lastName = $rootScope.userData.lastName; | ||
3313 | + userInfo.emailId = $rootScope.userData.emailId; | ||
3314 | + } | ||
3315 | + | ||
3316 | + AdminService.SendAdminAccessRequestMail(userInfo) | ||
3317 | + .then(function (result) { | ||
3318 | + if (result == AdminConstants.MAIL_SENT) { | ||
3319 | + $("#adminModal").fadeOut(); | ||
3320 | + $("#adminModal").modal('hide'); | ||
3321 | + $("adminAccessTextArea").text(''); | ||
3322 | + | ||
3323 | + $rootScope.errorMassage = AdminConstants.MAIL_SENT; | ||
3324 | + $("#messageModal").modal('show'); | ||
3325 | + } | ||
3326 | + }, | ||
3327 | + function (error) { | ||
3328 | + console.log(' Error in sending mail to admin support = ' + error.statusText); | ||
3329 | + $rootScope.errorMassage = AdminConstants.ERROR_IN_SENDING_MAIL; | ||
3330 | + $("#messageModal").modal('show'); | ||
3331 | + }); | ||
3332 | + }; | ||
3333 | + | ||
3334 | + $rootScope.CloseAAModal = function () { | ||
3335 | + $("#adminModal").fadeOut(); | ||
3336 | + $("#adminModal").modal('hide'); | ||
3337 | + $("adminAccessTextArea").text(''); | ||
3338 | + } | ||
3290 | }] | 3339 | }] |
3291 | ); | 3340 | ); |
3292 | \ No newline at end of file | 3341 | \ No newline at end of file |
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
@@ -310,6 +310,21 @@ AIA.constant("LoginMessageConstants", { | @@ -310,6 +310,21 @@ AIA.constant("LoginMessageConstants", { | ||
310 | //"MAIL_NOT_SENT": "Mail not sent." | 310 | //"MAIL_NOT_SENT": "Mail not sent." |
311 | 311 | ||
312 | }) | 312 | }) |
313 | +AIA.constant("AdminConstants", { | ||
314 | + "ERROR_IN_SENDING_MAIL": "Some internal error occured.", | ||
315 | + "MAIL_SENT": "Mail sent." | ||
316 | +}) | ||
317 | +AIA.constant("UserTypeConstants", { | ||
318 | + "SUPER_ADMIN": "Super Admin", | ||
319 | + "GENERAL_ADMIN": "General Admin", | ||
320 | + "DISTRICT_ADMIN": "District Admin", | ||
321 | + "CLIENT_ADMIN": "Client Admin", | ||
322 | + "SINGLE_USER": "Single User", | ||
323 | + "CONCURRENT_USER": "Concurrent User", | ||
324 | + "RESELLER": "Reseller", | ||
325 | + "TEST_ACCOUNT": "Test Account", | ||
326 | + "SITE_USER": "Site User" | ||
327 | +}) | ||
313 | AIA.constant("UserModules", [ | 328 | AIA.constant("UserModules", [ |
314 | { | 329 | { |
315 | "name": "Dissectible Anatomy", | 330 | "name": "Dissectible Anatomy", |
400-SOURCECODE/AIAHTML5.Web/app/services/AdminService.js
0 → 100644
1 | +AIA.factory('AdminService', function ($http, $q) { | ||
2 | + return { | ||
3 | + SendAdminAccessRequestMail: function (userInfo) { | ||
4 | + var deferred = $q.defer(); | ||
5 | + | ||
6 | + $http.post('/API/api/AdminAccess', userInfo, { | ||
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 | \ No newline at end of file | 22 | \ No newline at end of file |
400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | return deferred.promise; | 18 | return deferred.promise; |
19 | }, | 19 | }, |
20 | 20 | ||
21 | - SendMailToUser: function (userInfo, isPassword) { | 21 | + SendMailToUser: function (userInfo, havePassword) { |
22 | var deferred = $q.defer(); | 22 | var deferred = $q.defer(); |
23 | 23 | ||
24 | $http.post('/API/api/ForgotUser', userInfo, { //JSON.stringify(userEmail) | 24 | $http.post('/API/api/ForgotUser', userInfo, { //JSON.stringify(userEmail) |
400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html
@@ -49,7 +49,7 @@ | @@ -49,7 +49,7 @@ | ||
49 | <li><a href="http://interactiveanatomy.com/v107/content/en_US/help/about/Adam_Credits_AIA5.html" target="_blank">About A.D.A.M.</a></li> | 49 | <li><a href="http://interactiveanatomy.com/v107/content/en_US/help/about/Adam_Credits_AIA5.html" target="_blank">About A.D.A.M.</a></li> |
50 | </ul> | 50 | </ul> |
51 | </li> | 51 | </li> |
52 | - <li><a href="#">Admin</a></li> | 52 | + <li><a ng-click="OpenAdminForm()" role="button" data-toggle="modal" class="btn" data-target="#adminModal" ng-hide="notAnAdmin">Admin</a></li> |
53 | </ul> | 53 | </ul> |
54 | <ul class="nav navbar-nav navbar-right"> | 54 | <ul class="nav navbar-nav navbar-right"> |
55 | <li class="visible-xs"><a href="" ng-click="LogoutUser()">Logout</a></li> | 55 | <li class="visible-xs"><a href="" ng-click="LogoutUser()">Logout</a></li> |
400-SOURCECODE/AIAHTML5.Web/index.html
@@ -1164,6 +1164,57 @@ | @@ -1164,6 +1164,57 @@ | ||
1164 | </div> | 1164 | </div> |
1165 | </div> | 1165 | </div> |
1166 | 1166 | ||
1167 | + <!--Admin Form (Under Process)--> | ||
1168 | + <div class="modal fade ui-draggable in" id="adminModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" style="padding-left: 17px; "> | ||
1169 | + <div class="modal-dialog" role="document"> | ||
1170 | + <div class="modal-content"> | ||
1171 | + <div class="modal-header ui-draggable-handle" style="color: #e5e5e5;"> <!--bg-primary--> | ||
1172 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close" id="btnCloseAAModal" ng-click="CloseAAModal()"><span aria-hidden="true">×</span></button> | ||
1173 | + <h5 class="text-left lhgt19 padd5" style="color:red; text-align:left;">*This module is not yet available to use, please fill in the form with complete details, a support request will be submitted to ADAM Education Sales and Support team. If needed someone from ADAM team will contact you ASAP.</h5> | ||
1174 | + </div> | ||
1175 | + <div class="modal-body"> | ||
1176 | + <div class="panel-body"> | ||
1177 | + <!-- form --> | ||
1178 | + <form class="form-horizontal" name="adminAccessRequestForm"> | ||
1179 | + <div class="form-group"> | ||
1180 | + <label for="inputEmail3" class="col-sm-3 control-label">First Name :</label> | ||
1181 | + <div class="col-sm-8"> | ||
1182 | + <input class="form-control" id="adminfName" placeholder="" ng-model=" userinfo.firstname" ng-readonly="true"> | ||
1183 | + </div> | ||
1184 | + </div> | ||
1185 | + <div class="form-group"> | ||
1186 | + <label for="inputPassword3" class="col-sm-3 control-label">Last Name :</label> | ||
1187 | + <div class="col-sm-8"> | ||
1188 | + <input class="form-control" id="adminlName" placeholder="" type="text" ng-model="userInfo.lastName" ng-readonly="true"> | ||
1189 | + </div> | ||
1190 | + </div> | ||
1191 | + <div class="form-group"> | ||
1192 | + <label for="inputPassword3" class="col-sm-3 control-label">Email Id <span class="red">*</span> :</label> | ||
1193 | + <div class="col-sm-8"> | ||
1194 | + <input class="form-control" id="adminEmailId" placeholder="" type="text" ng-model="userInfo.emailId" ng-readonly="true"> | ||
1195 | + </div> | ||
1196 | + </div> | ||
1197 | + <div class="form-group"> | ||
1198 | + <label for="inputPassword3" class="col-sm-3 control-label">Message <span class="red">*</span> :</label> | ||
1199 | + <div class="col-sm-8"> | ||
1200 | + <textarea name="adminAccessTextArea" class="form-control" rows="3" placeholder="Message" ng-model="userInfo.userMessage" required></textarea> <!--ng-show="!adminRequestTextArea.length--> | ||
1201 | + <span id="spnError" style="color: maroon; font-weight:bold" ng-show="adminAccessRequestForm.adminAccessTextArea.$invalid">Message required.</span> | ||
1202 | + </div> | ||
1203 | + </div> | ||
1204 | + <div class="form-group"> | ||
1205 | + <div class="col-sm-offset-3 col-sm-8 mar-top17"> | ||
1206 | + <button type="button" class="btn btn-primary btn-sm" ng-click="adminAccessRequestForm.$valid && SendAdminAccessRequestMail(userInfo)" data-toggle="modal" data-target="#mymodal"><i class="fa fa-check"></i> Submit</button> | ||
1207 | + </div> | ||
1208 | + | ||
1209 | + </div> | ||
1210 | + </form> | ||
1211 | + </div> | ||
1212 | + </div> | ||
1213 | + | ||
1214 | + </div> | ||
1215 | + </div> | ||
1216 | + </div> | ||
1217 | + | ||
1167 | <script> | 1218 | <script> |
1168 | 1219 | ||
1169 | function enableDisableFillOption() { | 1220 | function enableDisableFillOption() { |
@@ -1293,6 +1344,7 @@ | @@ -1293,6 +1344,7 @@ | ||
1293 | <script src="app/controllers/HomeController.js"></script> | 1344 | <script src="app/controllers/HomeController.js"></script> |
1294 | <script src="app/controllers/LinkController.js"></script> | 1345 | <script src="app/controllers/LinkController.js"></script> |
1295 | <script src="app/services/AuthenticationService.js"></script> | 1346 | <script src="app/services/AuthenticationService.js"></script> |
1347 | + <script src="app/services/AdminService.js"></script> | ||
1296 | 1348 | ||
1297 | <script src="app/services/DataService.js"></script> | 1349 | <script src="app/services/DataService.js"></script> |
1298 | <script src="libs/jquery/jquery_plugin/jqueryui.js"></script> | 1350 | <script src="libs/jquery/jquery_plugin/jqueryui.js"></script> |