【问题标题】:Disable account creation with OAuth使用 OAuth 禁用帐户创建
【发布时间】:2013-07-24 10:58:07
【问题描述】:

使用 ASP.NET 项目中提供的标准 OAuth 功能,我希望用户能够将他们的帐户连接到 Facebook 和 GMail 帐户,但默认情况下,您也可以使用外部登录链接注册一个新帐户,我希望禁用此功能。

如何禁用此功能?

【问题讨论】:

    标签: asp.net oauth-2.0


    【解决方案1】:

    我通过在 ProcessProviderResult() 类的 RegisterExternalLogin.aspx.cs 中更改它来解决它

            if (User.Identity.IsAuthenticated)
            {
                // User is already authenticated, add the external login and redirect to return url
                OpenAuth.AddAccountToExistingUser(ProviderName, ProviderUserId, ProviderUserName, User.Identity.Name);
                RedirectToReturnUrl();
            }
            else
            {
                Response.Redirect("~/Account/Register.aspx");
                // User is new, ask for their desired membership name
                // userName.Text = authResult.UserName;
            }
    

    如果用户未通过身份验证,我会将用户重定向到正常的注册页面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-16
      • 1970-01-01
      • 1970-01-01
      • 2020-10-15
      • 1970-01-01
      相关资源
      最近更新 更多