return false;
}
+ private bool IsAdmin(string login, string password)
+ {
+ return Database.Users.Any(t => t.IsAdmin && t.Login == login && t.Password == password);
+ }
+
+ private bool IsAdmin(string password)
+ {
+ return Database.Users.Any(t => t.IsAdmin && t.Password == password);
+ }
+
// GET: Index
[HttpGet]
public ActionResult Index(int? year) {
if(Request.Cookies["allowed"] == null && !IsLocal())
return Redirect("http://www.cpeonline.com/webcasts");
- string systemPassword = ConfigurationManager.AppSettings["password"];
- if(Request.Cookies["allowed"] != null && (Request.Cookies["allowed"].Value != systemPassword))
+
+ //string systemPassword = ConfigurationManager.AppSettings["password"];
+ if (Request.Cookies["allowed"] != null && !IsAdmin(Request.Cookies["allowed"].Value))
+ {
return Redirect("http://www.cpeonline.com/webcasts");
+ }
+
DateTime now = DateTime.UtcNow;
if(!year.HasValue) {
public ActionResult Email() {
var email = new MailMessage {
To = {
- "tallen@intesolv.com"
+ "sophia@sophicsystems.com"
},
Subject = "[CPE] Email Test",
Body = "Email test has been received.",
return Redirect("/");
}
+ public ActionResult SendCerificateEmail(string email, string url, string key)
+ {
+ if (key != "q1w2e3") return Content("Bad key");
+ var course = Database.PurchasedCourses
+ .Where(c => c.Email == email && c.ContentUrl == url)
+ .OrderByDescending(c => c.CertificateDate).FirstOrDefault();
+
+ var done = SendEmailHelperWeb.SendCertificateEmail(course);
+
+ var s = url.Split('-');
+ var courseName = Database.CourseDetails
+ .FirstOrDefault(c => c.ReleaseCode == s[1])?.Name;
+
+ Utilities.LogWrapper.Info("[TinCanHelper][HandleStatement] {0} cert sent email={1} courseName={2}", DateTime.UtcNow.ToString("yyyyMMdd_HHmmss"), email, courseName);
+
+ return Content("Certificate send successfully");
+ }
[HttpPost]
public ActionResult Admin(string login, string passcode) {
login = login?.Trim();
passcode = passcode?.Trim();
- string systemPassword = ConfigurationManager.AppSettings["password"];
- if(login == ConfigurationManager.AppSettings["login"] & passcode == systemPassword) {
+ // string systemPassword = ConfigurationManager.AppSettings["password"];
+ if(IsAdmin(login, passcode)) {
var reportingCookie = new HttpCookie("allowed") {
- Value = systemPassword,
+ Value = passcode,
Expires = DateTime.UtcNow.AddDays(1)
};
Response.Cookies.Add(reportingCookie);
public ActionResult Elucidat() {
if(Request.Cookies["allowed"] == null && !IsLocal())
return Redirect("http://www.cpeonline.com/webcasts");
- string systemPassword = ConfigurationManager.AppSettings["password"];
- if(Request.Cookies["allowed"] != null && (Request.Cookies["allowed"].Value != systemPassword))
+// string systemPassword = ConfigurationManager.AppSettings["password"];
+ if(Request.Cookies["allowed"] != null && (!IsAdmin(Request.Cookies["allowed"].Value)))
return Redirect("http://www.cpeonline.com/webcasts");
DateTime now = DateTime.UtcNow;