ManageLogins.cshtml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. @model Winsoft.GOV.XF.WX.Models.ManageLoginsViewModel
  2. @using Microsoft.Owin.Security
  3. @{
  4. ViewBag.Title = "管理你的外部登录名";
  5. }
  6. <h2>@ViewBag.Title。</h2>
  7. <p class="text-success">@ViewBag.StatusMessage</p>
  8. @{
  9. var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes();
  10. if (loginProviders.Count() == 0) {
  11. <div>
  12. <p>
  13. There are no external authentication services configured. See <a href="https://go.microsoft.com/fwlink/?LinkId=313242">this article</a>
  14. for details on setting up this ASP.NET application to support logging in via external services.
  15. </p>
  16. </div>
  17. }
  18. else
  19. {
  20. if (Model.CurrentLogins.Count > 0)
  21. {
  22. <h4>已注册的登录名</h4>
  23. <table class="table">
  24. <tbody>
  25. @foreach (var account in Model.CurrentLogins)
  26. {
  27. <tr>
  28. <td>@account.LoginProvider</td>
  29. <td>
  30. @if (ViewBag.ShowRemoveButton)
  31. {
  32. using (Html.BeginForm("RemoveLogin", "Manage"))
  33. {
  34. @Html.AntiForgeryToken()
  35. <div>
  36. @Html.Hidden("loginProvider", account.LoginProvider)
  37. @Html.Hidden("providerKey", account.ProviderKey)
  38. <input type="submit" class="btn btn-default" value="删除" title="从你的帐户中删除此 @account.LoginProvider 登录名" />
  39. </div>
  40. }
  41. }
  42. else
  43. {
  44. @: &nbsp;
  45. }
  46. </td>
  47. </tr>
  48. }
  49. </tbody>
  50. </table>
  51. }
  52. if (Model.OtherLogins.Count > 0)
  53. {
  54. using (Html.BeginForm("LinkLogin", "Manage"))
  55. {
  56. @Html.AntiForgeryToken()
  57. <div id="socialLoginList">
  58. <p>
  59. @foreach (AuthenticationDescription p in Model.OtherLogins)
  60. {
  61. <button type="submit" class="btn btn-default" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" title="使用你的 @p.Caption 帐户登录">@p.AuthenticationType</button>
  62. }
  63. </p>
  64. </div>
  65. }
  66. }
  67. }
  68. }