当前位置: 首页>>代码示例>>C#>>正文


C# UserManager.ValidateUser方法代码示例

本文整理汇总了C#中UserManager.ValidateUser方法的典型用法代码示例。如果您正苦于以下问题:C# UserManager.ValidateUser方法的具体用法?C# UserManager.ValidateUser怎么用?C# UserManager.ValidateUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserManager的用法示例。


在下文中一共展示了UserManager.ValidateUser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Find

        public JsonResult Find(string userName, string password)
        {
            UserManager manager = new UserManager();
            var user = manager.ValidateUser(userName, password);

            return Json(user, JsonRequestBehavior.AllowGet);
        }
开发者ID:raberana,项目名称:MWMSWebService,代码行数:7,代码来源:HomeController.cs

示例2: GetValidatedUser

 public HttpResponseMessage GetValidatedUser(LoginUser loginUser)
 {
     UserManager userManager = new UserManager();
     try
     {
         var savedUser = userManager.ValidateUser(loginUser.UserName.Trim(), loginUser.Password.Trim());
         HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Accepted, loginUser);
         return response;
     }
     catch (Exception ex)
     {
         return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message);
     }
 }
开发者ID:raberana,项目名称:MWMSWebService,代码行数:14,代码来源:ValuesController.cs

示例3: SWT

        public ActionResult SWT(string realm, string redirect_uri, string deflate, string wrap_name, string wrap_password, string sf_domain = "Default", string sf_persistent = "false", string is_form = "false")
        {
            var model = new LoginModel();
            UserManager um = new UserManager(sf_domain);
            if (um.ValidateUser(wrap_name, wrap_password))
            {
                Session["tfa.authState"] = 1;
                Session["tfa.realm"] = realm;
                Session["tfa.redirect_uri"] = redirect_uri;
                Session["tfa.deflate"] = deflate;
                Session["tfa.wrap_name"] = wrap_name;
                Session["tfa.sf_persistent"] = sf_persistent;

                UserProfileManager profileManager = UserProfileManager.GetManager();
                UserManager userManager = UserManager.GetManager();

                User user = userManager.GetUser(wrap_name);

                UserProfile profile = null;

                if (user != null)
                {
                    profile = profileManager.GetUserProfile<SitefinityProfile>(user);

                    string authyId = profile.GetValue<string>("AuthyId");

                    bool useTwoFactor = false;

                    if (!String.IsNullOrWhiteSpace(authyId))
                    {
                        useTwoFactor = true;

                        Session["tfa.authyId"] = authyId;
                    }

                    if (is_form == "false")
                    {
                        if (useTwoFactor)
                        {
                            return Json(new { url = "/TFA/Authenticate/Verify" });
                        }

                        return Json(new { url = GetLoginUri() });
                    }
                    else
                    {
                        if (useTwoFactor)
                        {
                            return Redirect("/TFA/Authenticate/Verify");
                        }

                        return Redirect(GetLoginUri());
                    }
                }
            }

            model.ProvidersList = GetProvidersList();

            ModelState.AddModelError("InvalidCredentials", "Incorrect Username/Password Combination");

            return View("Login", model);
        }
开发者ID:timw255,项目名称:timw255.Sitefinity.TwoFactorAuthentication,代码行数:62,代码来源:AuthenticateController.cs

示例4: ValidateUser

 public User ValidateUser(string userName, string password)
 {
     User result = null;
     using (UserManager manager = new UserManager())
     {
         result = manager.ValidateUser(userName, password);
     }
     return result;
 }
开发者ID:Q-Team,项目名称:US-Backend-Candidate-Lab,代码行数:9,代码来源:API.NETWebService.asmx.cs


注:本文中的UserManager.ValidateUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。