Example #1
0
        public ActionResult Login(AdminLogin admin)
        {
            ViewBag.IsLogin = false;
            PezeshkPlusEntities db        = new PezeshkPlusEntities();
            List <int?>         CheckMail = db.USP_SEL_Email(admin.Email).ToList();

            if (CheckMail.Count == 0)
            {
                TempData["WrongEmail"] = "ایمیل وارد شده صحیح نمی باشد!";
                return(RedirectToAction("Login"));
            }

            List <int?> CheckPass = db.USP_SEL_Password(admin.Email, admin.Password).ToList();

            if (CheckPass.Count == 0)
            {
                TempData["WrongPass"] = "******";
                return(RedirectToAction("Login"));
            }

            string authID = Guid.NewGuid().ToString();

            Session["AuthID"] = authID;

            Response.Cookies["AuthID"].Value = authID;

            Session[authID]        = admin.Email;
            Session[authID + "IP"] = Request.UserHostAddress;

            string previousUrl = Session["PreviousUrl"].ToString();

            Session.Remove("PreviousUrl");

            return(Redirect(previousUrl));
        }
Example #2
0
        public JsonResult PasswordValidation(DoctorProfile doctor)
        {
            PezeshkPlusEntities db = new PezeshkPlusEntities();

            USP_SEL_Doctor_Result doctorLastInfo = (USP_SEL_Doctor_Result)Session["DoctorInfo"];

            List <int?> CheckPassword = db.USP_SEL_Password(doctorLastInfo.Email, doctor.Password).ToList();

            if (CheckPassword.Count == 0)
            {
                return(Json("پسورد وارد شده اشتباه است", JsonRequestBehavior.DenyGet));
            }
            return(Json(true, JsonRequestBehavior.DenyGet));
        }
Example #3
0
        public ActionResult Login(RegisterPack doctor)
        {
            ViewBag.IsLogin = false;
            PezeshkPlusEntities db        = new PezeshkPlusEntities();
            List <int?>         CheckMail = db.USP_SEL_Email(doctor.LoginModel.Email).ToList();

            if (CheckMail.Count == 0)
            {
                TempData["WrongEmail"] = "ایمیل وارد شده صحیح نمی باشد!";
                return(RedirectToAction("Register"));
            }

            List <int?> CheckPass = db.USP_SEL_Password(doctor.LoginModel.Email, doctor.LoginModel.Password).ToList();

            if (CheckPass.Count == 0)
            {
                TempData["WrongPass"] = "******";
                return(RedirectToAction("Register"));
            }

            List <bool?> IsActive = db.USP_SEL_IsDoctorActive(doctor.LoginModel.Email).ToList();

            if (IsActive[0] == false)
            {
                TempData["NotActive"] = "ثبت نام شما هنوز توسط مدیریت تایید نشده!";
                return(RedirectToAction("Register"));
            }

            string authID = Guid.NewGuid().ToString();

            Session["AuthID"] = authID;

            Response.Cookies["AuthID"].Value = authID;

            Session[authID]        = doctor.LoginModel.Email;
            Session[authID + "IP"] = Request.UserHostAddress;

            string previousUrl = Session["PreviousUrl"].ToString();

            Session.Remove("PreviousUrl");

            return(Redirect(previousUrl));
        }