Example #1
0
 public static bool login(PatientLogin _ptlogin)
 {
     return(Membership.ValidateUser(_ptlogin.UserName, _ptlogin.Password));
 }
Example #2
0
        public JsonResult Login(UserLogin _login)
        {
            string retmsg = "Error";
            string getid = Request.ServerVariables["http_referer"];
            if (!string.IsNullOrEmpty(getid)) { getid = getid.ToLower(); }
            string ReturnUrl = string.Empty;
            string url = ConfigurationManager.AppSettings["SiteUrl"];
            if (getid.Contains("riskanalysis"))
            {
                if (!string.IsNullOrEmpty(getid))
                {
                    string[] getreturnurl = getid.Split('=');
                    ReturnUrl = getreturnurl[1].ToString();
                }
            }
            PatientLogin _ptlogin = new PatientLogin() { UserName = _login.UserName, Password = _login.Password };
            bool IsAuth = PatientLogin.login(_ptlogin);

            if (IsAuth)
            {
                string[] GetRole = Roles.GetRolesForUser(_login.UserName);
                FormsAuthentication.SetAuthCookie(_login.UserName, true);
                //if (!string.IsNullOrEmpty(ReturnUrl))
                //    return Redirect(url + "/" + ReturnUrl);
                //else
                //    return RedirectToAction("QuestionPart1", "Question");
                retmsg = "Success";
            }
            else
            {
                retmsg = "Invalid credentials!";
            }

            return Json(retmsg, JsonRequestBehavior.AllowGet);
        }
Example #3
0
 public static bool login(PatientLogin _ptlogin)
 {
     return Membership.ValidateUser(_ptlogin.UserName, _ptlogin.Password);
 }