本文整理汇总了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);
}
示例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);
}
}
示例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;
}