本文整理汇总了C#中IJabbrRepository.GetUserByName方法的典型用法代码示例。如果您正苦于以下问题:C# IJabbrRepository.GetUserByName方法的具体用法?C# IJabbrRepository.GetUserByName怎么用?C# IJabbrRepository.GetUserByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IJabbrRepository
的用法示例。
在下文中一共展示了IJabbrRepository.GetUserByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AccountModule
//.........这里部分代码省略.........
return View["requestresetpassword"];
};
Post["/requestresetpassword"] = _ =>
{
if (!HasValidCsrfTokenOrSecHeader)
{
return HttpStatusCode.Forbidden;
}
if (IsAuthenticated)
{
return Response.AsRedirect("~/account/#changePassword");
}
if (!Principal.Identity.IsAuthenticated &&
!applicationSettings.AllowUserResetPassword ||
string.IsNullOrWhiteSpace(applicationSettings.EmailSender))
{
return HttpStatusCode.NotFound;
}
string username = Request.Form.username;
if (String.IsNullOrEmpty(username))
{
this.AddValidationError("username", LanguageResources.Authentication_NameRequired);
}
try
{
if (ModelValidationResult.IsValid)
{
ChatUser user = repository.GetUserByName(username);
if (user == null)
{
this.AddValidationError("username", String.Format(LanguageResources.Account_NoMatchingUser, username));
}
else if (String.IsNullOrWhiteSpace(user.Email))
{
this.AddValidationError("username", String.Format(LanguageResources.Account_NoEmailForUser, username));
}
else
{
membershipService.RequestResetPassword(user, applicationSettings.RequestResetPasswordValidThroughInHours);
repository.CommitChanges();
emailService.SendRequestResetPassword(user, this.Request.Url.SiteBase + "/account/resetpassword/");
return View["requestresetpasswordsuccess", username];
}
}
}
catch (Exception ex)
{
this.AddValidationError("_FORM", ex.Message);
}
return View["requestresetpassword"];
};
Get["/resetpassword/{id}"] = parameters =>
{
if (!applicationSettings.AllowUserResetPassword ||
string.IsNullOrWhiteSpace(applicationSettings.EmailSender))