Пример #1
0
 public ActionResult Index(User user, Captcha captcha)
 {
     //Sessin contains expected captcha value.
     if (captcha == null || Session["Captcha"] == null || Session["Captcha"].ToString() != captcha.CaptchaResult)
     {
         ModelState.AddModelError("Captcha", "Wrong captcha value. Try again.");
         //display error and generate a new captcha
         return View();
     }
     //check user here!
     //if (CoreWrapper.Instance.UserExists(user.Login))
     //{
     FormsAuthentication.SetAuthCookie(user.Login, true);
     return RedirectToAction("Index", "Admin");
     //}
     //return View();
 }
Пример #2
0
 private IUser CreateUserModelInstance(DataRow row)
 {
     User u = new User()
     {
         Id = Convert.ToInt32(row["Id"]),
         Login = row["Login"].ToString(),
         Password = row["Password"].ToString(),
         Name = row["Name"].ToString(),
         Surname = row["Surname"].ToString(),
         Email = row["Email"].ToString(),
         IsActive = Convert.ToBoolean(row["IsActive"]),
         UserType = (UserType)Enum.Parse(typeof(UserType), row["UserType"].ToString())
     };
     return u;
 }