my-gitea-templates/templates/user/auth/ signin_inner.tmpl
81 lines
3.2 KiB

  1. {{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn)}}
  2. {{template "base/alert" .}}
  3. {{end}}
  4. <h4 class="ui top attached header center">
  5. {{if .LinkAccountMode}}
  6. {{.i18n.Tr "auth.oauth_signin_title"}}
  7. {{else}}
  8. {{.i18n.Tr "auth.login_userpass"}}
  9. {{end}}
  10. </h4>
  11. <div class="ui attached segment">
  12. <form class="ui form" action="{{.SignInLink}}" method="post">
  13. {{.CsrfTokenHtml}}
  14. {{if and .OrderedOAuth2Names .OAuth2Providers}}
  15. <div class="oauth center">
  16. <div id="oauth2-login-loader" class="ui disabled centered loader"></div>
  17. <div>
  18. <div id="oauth2-login-navigator">
  19. {{range $key := .OrderedOAuth2Names}}
  20. {{$provider := index $.OAuth2Providers $key}}
  21. <a href="{{AppSubUrl}}/user/oauth2/{{$key}}">
  22. <img
  23. style="width: 80px; height: auto; margin: 20px;"
  24. alt="{{$provider.DisplayName}}{{if eq $provider.Name "openidConnect"}} ({{$key}}){{end}}"
  25. title="{{$provider.DisplayName}}{{if eq $provider.Name "openidConnect"}} ({{$key}}){{end}}"
  26. class="{{$provider.Name}}"
  27. src="{{AppSubUrl}}{{$provider.Image}}"
  28. onclick="window.onOAuthLoginClick()"
  29. ></a>
  30. {{end}}
  31. </div>
  32. </div>
  33. <p>Please log in with one of these identity providers.</p>
  34. <p style="font-style: italic;">(apologies for limiting your choice of identity provider; it's a compromise for the time being. When will <a href="https://openid.net/">OpenID</a>, <a href="https://webid.info/">WebID</a>, <a href="https://en.wikipedia.org/wiki/BrowserID">BrowserID</a> or whatever vendor-neutral solution finally be adopted widely?)</p>
  35. </div>
  36. {{end}}
  37. <details style="margin-top: 2em;"><summary style="color: lightgrey;">Staff entrance</summary>
  38. <div class="required inline field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
  39. <label for="user_name">{{.i18n.Tr "home.uname_holder"}}</label>
  40. <input id="user_name" name="user_name" value="{{.user_name}}" autofocus required>
  41. </div>
  42. {{if or (not .DisablePassword) .LinkAccountMode}}
  43. <div class="required inline field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
  44. <label for="password">{{.i18n.Tr "password"}}</label>
  45. <input id="password" name="password" type="password" value="{{.password}}" autocomplete="off" required>
  46. </div>
  47. {{end}}
  48. {{if not .LinkAccountMode}}
  49. <div class="inline field">
  50. <label></label>
  51. <div class="ui checkbox">
  52. <label>{{.i18n.Tr "auth.remember_me"}}</label>
  53. <input name="remember" type="checkbox">
  54. </div>
  55. </div>
  56. {{end}}
  57. <div class="inline field">
  58. <label></label>
  59. <button class="ui green button">
  60. {{if .LinkAccountMode}}
  61. {{.i18n.Tr "auth.oauth_signin_submit"}}
  62. {{else}}
  63. {{.i18n.Tr "sign_in"}}
  64. {{end}}
  65. </button>
  66. <a href="{{AppSubUrl}}/user/forgot_password">{{.i18n.Tr "auth.forgot_password"}}</a>
  67. </div>
  68. {{if .ShowRegistrationButton}}
  69. <div class="inline field">
  70. <label></label>
  71. <a href="{{AppSubUrl}}/user/sign_up">{{.i18n.Tr "auth.sign_up_now" | Str2html}}</a>
  72. </div>
  73. {{end}}
  74. </details>
  75. </form>
  76. </div>