コード例 #1
0
 public ActionResult Login(LoginModel info)
 {
     try
     {
         using (BusinessLogicLayer.ContextBLL ctx = new BusinessLogicLayer.ContextBLL())
         {
             BusinessLogicLayer.UserBLL user = ctx.FindUserByEmail(info.EmailAddress);
             if (user == null)
             {
                 info.Message = $"The EmailAddress '{info.EmailAddress}' does not exist in the database";
                 return(View(info));
             }
             string actual = user.Password;
             //string potential = user.Salt + info.Password;
             //bool validateduser = Sybool Valstem.Web.Helpers.Crypto.VerifyHashedPassword(actual, potential);
             bool validateduser = user.Password == info.Password;
             if (validateduser)
             {
                 Session["AUTHEmailAddress"] = user.EmailAddress;
                 Session["AUTHRole"]         = user.Role;
                 return(Redirect(info.ReturnURL));
             }
             info.Message = "The password was incorrect";
             return(View(info));
         }
     }
     catch (Exception ex)
     {
         return(View("Error", ex));
     }
 }
コード例 #2
0
 // GET: Gecko
 public ActionResult Index()
 {
     try
     {
         using (BusinessLogicLayer.ContextBLL ctx = new BusinessLogicLayer.ContextBLL())
         {
             string  id = HttpContext.User.Identity.Name;
             UserBLL u  = ctx.FindUserByEmail(id);
             var     m  = ctx.GetGcekosRelatedToUser(0, 100, u.UserID);
             return(View(m));
         }
     }
     catch (Exception ex)
     {
         return(View("Error", ex));
     }
 }