本文整理汇总了C#中Microsoft.AspNet.Identity.EntityFramework.IdentityManager.GetLogins方法的典型用法代码示例。如果您正苦于以下问题:C# IdentityManager.GetLogins方法的具体用法?C# IdentityManager.GetLogins怎么用?C# IdentityManager.GetLogins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.AspNet.Identity.EntityFramework.IdentityManager
的用法示例。
在下文中一共展示了IdentityManager.GetLogins方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load()
{
if (!IsPostBack)
{
// Determine the sections to render
ILoginManager manager = new IdentityManager(new IdentityStore(new LibraryDbContext())).Logins;
if (manager.HasLocalLogin(User.Identity.GetUserId()))
{
changePasswordHolder.Visible = true;
}
else
{
setPassword.Visible = true;
changePasswordHolder.Visible = false;
}
CanRemoveExternalLogins = manager.GetLogins(User.Identity.GetUserId()).Count() > 1;
// Render success message
var message = Request.QueryString["m"];
if (message != null)
{
// Strip the query string from action
Form.Action = ResolveUrl("~/Account/Manage");
SuccessMessage =
message == "ChangePwdSuccess" ? "Your password has been changed."
: message == "SetPwdSuccess" ? "Your password has been set."
: message == "RemoveLoginSuccess" ? "The account was removed."
: String.Empty;
successMessage.Visible = !String.IsNullOrEmpty(SuccessMessage);
}
}
}
示例2: GetLogins
public IEnumerable<IUserLogin> GetLogins()
{
ILoginManager manager = new IdentityManager(new IdentityStore(new ForumEmeraldContext())).Logins;
var accounts = manager.GetLogins(User.Identity.GetUserId());
CanRemoveExternalLogins = accounts.Count() > 1;
return accounts;
}
示例3: GetLogins
public IEnumerable<IUserLogin> GetLogins()
{
ILoginManager manager = new IdentityManager(new IdentityStore(new BooksLibrarySystemContext())).Logins;
var accounts = manager.GetLogins(this.User.Identity.GetUserId());
this.CanRemoveExternalLogins = accounts.Count() > 1;
return accounts;
}
示例4: Page_Load
protected void Page_Load()
{
if (!IsPostBack)
{
// Determine the sections to render
ILoginManager manager = new IdentityManager(new IdentityStore(new ForumEmeraldContext())).Logins;
if (manager.HasLocalLogin(User.Identity.GetUserId()))
{
changePasswordHolder.Visible = true;
}
else
{
setPassword.Visible = true;
changePasswordHolder.Visible = false;
}
CanRemoveExternalLogins = manager.GetLogins(User.Identity.GetUserId()).Count() > 1;
// Render success message
var message = Request.QueryString["m"];
if (message != null)
{
// Strip the query string from action
Form.Action = ResolveUrl("~/Account/Manage");
SuccessMessage =
message == "ChangePwdSuccess" ? "Your password has been changed."
: message == "SetPwdSuccess" ? "Your password has been set."
: message == "RemoveLoginSuccess" ? "The account was removed."
: String.Empty;
successMessage.Visible = !String.IsNullOrEmpty(SuccessMessage);
}
var context = new ForumEmeraldContext();
using (context)
{
var username = this.User.Identity.GetUserName();
var user = context.Users.FirstOrDefault(x => x.UserName == username);
this.ImageProfilePicture.ImageUrl = user.PhotoPath;
this.ImageProfilePicture.AlternateText = user.UserName;
this.LabelCurrentEmail.Text = this.Server.HtmlEncode(user.Email);
this.CurrentUser.InnerText = this.Server.HtmlEncode(user.UserName);
}
}
}
示例5: Page_Load
protected void Page_Load()
{
if (!IsPostBack)
{
// Determine the sections to render
ILoginManager manager = new IdentityManager(new IdentityStore(new ApplicationDbContext())).Logins;
if (manager.HasLocalLogin(User.Identity.GetUserId()))
{
changePasswordHolder.Visible = true;
}
else
{
setPassword.Visible = true;
changePasswordHolder.Visible = false;
}
CanRemoveExternalLogins = manager.GetLogins(User.Identity.GetUserId()).Count() > 1;
// Render success message
var message = Request.QueryString["m"];
if (message != null)
{
// Strip the query string from action
Form.Action = ResolveUrl("~/Account/Manage");
SuccessMessage =
message == "ChangePwdSuccess" ? "Your password has been changed."
: message == "SetPwdSuccess" ? "Your password has been set."
: message == "RemoveLoginSuccess" ? "The account was removed."
: String.Empty;
successMessage.Visible = !String.IsNullOrEmpty(SuccessMessage);
}
ApplicationDbContext context = new ApplicationDbContext();
string username = User.Identity.GetUserName();
var image = context.Users.FirstOrDefault(u => u.UserName == username).AvatarLink;
string imageURL = AVATAR_PATH + image;
this.ImageAvatar.ImageUrl = imageURL;
}
}
示例6: Page_Load
protected void Page_Load()
{
if (!IsPostBack)
{
// Determine the sections to render
ILoginManager manager = new IdentityManager(new IdentityStore()).Logins;
if (manager.HasLocalLogin(User.Identity.GetUserId()))
{
changePasswordHolder.Visible = true;
}
else
{
setPassword.Visible = true;
changePasswordHolder.Visible = false;
}
CanRemoveExternalLogins = manager.GetLogins(User.Identity.GetUserId()).Count() > 1;
// Render success message
var message = Request.QueryString["m"];
if (message != null)
{
// Strip the query string from action
Form.Action = ResolveUrl("~/Account/Manage");
SuccessMessage =
message == "ChangePwdSuccess" ? "Your password has been changed."
: message == "SetPwdSuccess" ? "Your password has been set."
: message == "RemoveLoginSuccess" ? "The account was removed."
: String.Empty;
successMessage.Visible = !String.IsNullOrEmpty(SuccessMessage);
}
}
var username = Context.User.Identity.Name;
var context = new AcademyDbContext();
var user = context.Users.FirstOrDefault(u => u.UserName == username);
if (user != null)
{
var avatarPath = user.AvatarPath;
var avatarImage = this.PlaceHolderChangeAvatar.FindControl("ImageUserAvatar") as Image;
avatarImage.ImageUrl = avatarPath;
}
}