Beispiel #1
0
        public JsonResult login(string email, string pwd)
        {
            var response = Request["g-recaptcha-response"];

            if (!validateCaptcha.validateC(response))
            {
                return(Json(responseBLL.create(false, "Captca Hatası", null), JsonRequestBehavior.AllowGet));
            }
            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(pwd))
            {
                ViewBag.Mesaj = "Lütfen gerekli alanları doldurunuz.";
                return(Json(responseBLL.create(false, "Lütfen gerekli alanları doldurunuz.", null), JsonRequestBehavior.AllowGet));
            }
            else
            {
                string Sifre   = hashwithsha.ComputeHash(pwd, "SHA512", Encoding.ASCII.GetBytes(pwd));
                var    control = _user.GetFirstOrDefault(g => g.Password == Sifre && g.Email == email && g.Flag == status.active);
                if (control == null)
                {
                    ViewBag.Mesaj = "Kullanıcı bilgilerine ulaşılamadı.";
                    return(Json(responseBLL.create(false, "Kullanıcı bilgilerine ulaşılamadı.", null), JsonRequestBehavior.AllowGet));
                }
                else
                {
                    AuthBLL.LoadUser(control);
                    return(Json(responseBLL.create(true, "Giriş yapıldı.", null), JsonRequestBehavior.AllowGet));
                }
            }
        }