public bool SendEmail(Users user, string EncryptedRandomNum)
        {
            SystemSettingsRepository sysRepo = new SystemSettingsRepository();
            var sys = sysRepo.GetSystemSettings();

            string ResetPasswordLink = sys.CurrentDomain + "/Account/ResetPassword?id=" + EncryptedRandomNum;
            string Body = "Dear " + user.FullName + "," +
                          "<br/>" +
                          "<br/> Please <a href='" + ResetPasswordLink + "'>Click here</a> to Reset your Password at MANvFAT Football";

            EmailsRepository emailRepo = new EmailsRepository();

            return(emailRepo.SendEmail(SecurityUtils.SiteAdminEmail, user.EmailAddress, "Reset Password at MANvFAT Football", Body));
        }
        public ActionResult Contact(FormCollection formcollection)
        {
            string txtContactName  = formcollection["txtContactName"].ToString();
            string txtContactEmail = formcollection["txtContactEmail"].ToString();
            string txtContactMsg   = formcollection["txtContactMsg"].ToString();

            SecurityUtils.AddAuditLog("Contact Us", "Contact us email Received: Name: " + txtContactName + " Email: " + txtContactEmail);

            EmailsRepository emailRepo = new EmailsRepository();

            emailRepo.ContactEmail(txtContactName, txtContactEmail, txtContactMsg, this);

            return(View());
        }
        public ActionResult MobileVerification()
        {
            try
            {
                long            UserID            = Convert.ToInt64(Session["UserID"]);
                UsersRepository modelRepo         = new UsersRepository();
                var             model             = modelRepo.ReadOne(UserID);
                bool            IsMobileNumExists = true;
                Random          rndm = new Random();
                int             MobileVerificationCode = rndm.Next(111111, 999999);
                string          ErrorMsg = "";
                //Save and Send this Verification Code To User's Mobile Number if Mobile Number Exists
                if (modelRepo.ValidateMobileNumber(model.Mobile, ref ErrorMsg))
                {
                    //Save the Code for User
                    modelRepo.UpdateUserMobileVerificationCode(model.UserID, MobileVerificationCode);

                    //Send the Code to user's Mobile Number
                    EmailsRepository emailRepo = new EmailsRepository();
                    //TODO: Enable for Test or Live Site
                    emailRepo.SendEmail("*****@*****.**", model.Mobile + "@textmagic.com", "", MobileVerificationCode.ToString() + " is your MANvFAT verification code.");
                }
                else
                {
                    //If We didn't have Mobile number for this user then display the message, and Only Valid Admin users can update their Mobile Number under Maintenance=>Users
                    IsMobileNumExists = false;;
                }

                //will be used to Return to function to verify the Mobile Verification Code entered by User
                ViewBag.UserEmailAddress        = model.EmailAddress;
                ViewBag.UserMobilePhoneEndsWith = !string.IsNullOrEmpty(model.Mobile) && model.Mobile.Length > 3 ? "07** **** " + model.Mobile.Substring(model.Mobile.Length - 3) : "";
                ViewBag.IsMobileNumExists       = IsMobileNumExists;
            }
            catch (Exception ex)
            {
                ErrorHandling.HandleException(ex);

                return(RedirectToAction("Logon", "Account"));
            }
            return(View());
        }
Beispiel #4
0
 public InboxController()
 {
     _emailRepository = new EmailsRepository();
 }