gitea源码

signin_inner.tmpl 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <div class="ui container fluid">
  2. {{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn)}}
  3. {{template "base/alert" .}}
  4. {{end}}
  5. <h4 class="ui top attached header center">
  6. {{if .LinkAccountMode}}
  7. {{ctx.Locale.Tr "auth.oauth_signin_title"}}
  8. {{else}}
  9. {{ctx.Locale.Tr "auth.login_userpass"}}
  10. {{end}}
  11. </h4>
  12. <div class="ui attached segment">
  13. {{if .EnablePasswordSignInForm}}
  14. <form class="ui form" action="{{.SignInLink}}" method="post">
  15. {{.CsrfTokenHtml}}
  16. <div class="required field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
  17. <label for="user_name">{{ctx.Locale.Tr "home.uname_holder"}}</label>
  18. <input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required tabindex="1">
  19. </div>
  20. {{if or (not .DisablePassword) .LinkAccountMode}}
  21. <div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
  22. <div class="tw-flex tw-mb-1">
  23. <label for="password" class="tw-flex-1">{{ctx.Locale.Tr "password"}}</label>
  24. <a href="{{AppSubUrl}}/user/forgot_password" tabindex="4">{{ctx.Locale.Tr "auth.forgot_password"}}</a>
  25. </div>
  26. <input id="password" name="password" type="password" value="{{.password}}" autocomplete="current-password" required tabindex="2">
  27. </div>
  28. {{end}}
  29. {{if not .LinkAccountMode}}
  30. <div class="inline field">
  31. <div class="ui checkbox">
  32. <label>{{ctx.Locale.Tr "auth.remember_me"}}</label>
  33. <input name="remember" type="checkbox" tabindex="5">
  34. </div>
  35. </div>
  36. {{end}}
  37. {{template "user/auth/captcha" .}}
  38. <div class="field">
  39. <button class="ui primary button tw-w-full" tabindex="3">
  40. {{if .LinkAccountMode}}
  41. {{ctx.Locale.Tr "auth.oauth_signin_submit"}}
  42. {{else}}
  43. {{ctx.Locale.Tr "sign_in"}}
  44. {{end}}
  45. </button>
  46. </div>
  47. </form>
  48. {{end}}{{/*if .EnablePasswordSignInForm*/}}
  49. {{/* "oauth_container" contains not only "oauth2" methods, but also "OIDC" and "SSPI" methods */}}
  50. {{$showOAuth2Methods := or .OAuth2Providers .EnableOpenIDSignIn .EnableSSPI}}
  51. {{if and $showOAuth2Methods .EnablePasswordSignInForm}}
  52. <div class="divider divider-text">{{ctx.Locale.Tr "sign_in_or"}}</div>
  53. {{end}}
  54. {{if $showOAuth2Methods}}
  55. {{template "user/auth/oauth_container" .}}
  56. {{end}}
  57. </div>
  58. </div>
  59. {{if or .EnablePasskeyAuth .ShowRegistrationButton}}
  60. <div class="ui container fluid">
  61. <div class="ui attached segment header top tw-max-w-2xl tw-m-auto tw-flex tw-flex-col tw-items-center">
  62. {{if .EnablePasskeyAuth}}
  63. {{template "user/auth/webauthn_error" .}}
  64. <a class="signin-passkey">{{ctx.Locale.Tr "auth.signin_passkey"}}</a>
  65. {{end}}
  66. {{if .ShowRegistrationButton}}
  67. <div class="field">
  68. <span>{{ctx.Locale.Tr "auth.need_account"}}</span>
  69. <a href="{{AppSubUrl}}/user/sign_up">{{ctx.Locale.Tr "auth.sign_up_now"}}</a>
  70. </div>
  71. {{end}}
  72. </div>
  73. </div>
  74. {{end}}