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


C# IdentityManager.GetLogins方法代码示例

本文整理汇总了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);
                }
            }
        }
开发者ID:quela,项目名称:myprojects,代码行数:33,代码来源:Manage.aspx.cs

示例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;
 }
开发者ID:sabrie,项目名称:TelerikAcademy,代码行数:7,代码来源:Manage.aspx.cs

示例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;
 }
开发者ID:stoskov,项目名称:books-library-system,代码行数:7,代码来源:Manage.aspx.cs

示例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);
                }
            }
        }
开发者ID:sabrie,项目名称:TelerikAcademy,代码行数:44,代码来源:Manage.aspx.cs

示例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;
            }
        }
开发者ID:VelizarIT,项目名称:WebForms-SapphireForum,代码行数:39,代码来源:Manage.aspx.cs

示例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;
            }
        }
开发者ID:BobbyBorisov,项目名称:ChrysoberylAcademySystem,代码行数:43,代码来源:Manage.aspx.cs


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