Ejemplo n.º 1
0
 public ActionResult Login(string password, string email)
 {
     CryptoHelper cryptoHelper = new CryptoHelper();
     var ar = new AgenziaRepository();
     var agency = ar.GetByEmail(email);
     if (agency == null)
         return View("Register");
     var cryptedPassword = cryptoHelper.CryptPassword(password);
     if (cryptedPassword.Equals(agency.Password))
     {
         Session.Login(agency);
         if (agency.IsTourOperator)
             return RedirectToAction("TourOperatorDashboard", "Dashboard", new { id = agency.Id });
         return RedirectToAction("AgenziaDashboard", "Dashboard", new { id = agency.Id });
     }
     var viewModel = new RegisterViewModel();
     return View("Register", viewModel);
 }
Ejemplo n.º 2
0
 public ActionResult ResetPassword(string email)
 {
     var ar = new AgenziaRepository();
     var agency = ar.GetByEmail(email);
     if (agency != null)
     {
         CryptoHelper cryptoHelper = new CryptoHelper();
         var random = new Random();
         var password = random.Next().ToString();
         agency.Password = cryptoHelper.CryptPassword(password);
         ar.Save(agency);
         var mailerHelper = new MailerHelper();
         var text = string.Format("Gentile {0} la tua nuova password di Parti Comodo è: {1}", agency.Nome, password);
         mailerHelper.SendMail(email, text);
     }
     var viewModel = new RegisterViewModel();
     return View("Register", viewModel);
 }