You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

signin_inner.tmpl 3.9 kB

Oauth2 consumer (#679) * initial stuff for oauth2 login, fails on: * login button on the signIn page to start the OAuth2 flow and a callback for each provider Only GitHub is implemented for now * show login button only when the OAuth2 consumer is configured (and activated) * create macaron group for oauth2 urls * prevent net/http in modules (other then oauth2) * use a new data sessions oauth2 folder for storing the oauth2 session data * add missing 2FA when this is enabled on the user * add password option for OAuth2 user , for use with git over http and login to the GUI * add tip for registering a GitHub OAuth application * at startup of Gitea register all configured providers and also on adding/deleting of new providers * custom handling of errors in oauth2 request init + show better tip * add ExternalLoginUser model and migration script to add it to database * link a external account to an existing account (still need to handle wrong login and signup) and remove if user is removed * remove the linked external account from the user his settings * if user is unknown we allow him to register a new account or link it to some existing account * sign up with button on signin page (als change OAuth2Provider structure so we can store basic stuff about providers) * from gorilla/sessions docs: "Important Note: If you aren't using gorilla/mux, you need to wrap your handlers with context.ClearHandler as or else you will leak memory!" (we're using gorilla/sessions for storing oauth2 sessions) * use updated goth lib that now supports getting the OAuth2 user if the AccessToken is still valid instead of re-authenticating (prevent flooding the OAuth2 provider)
8 years ago
3 years ago
3 years ago
Oauth2 consumer (#679) * initial stuff for oauth2 login, fails on: * login button on the signIn page to start the OAuth2 flow and a callback for each provider Only GitHub is implemented for now * show login button only when the OAuth2 consumer is configured (and activated) * create macaron group for oauth2 urls * prevent net/http in modules (other then oauth2) * use a new data sessions oauth2 folder for storing the oauth2 session data * add missing 2FA when this is enabled on the user * add password option for OAuth2 user , for use with git over http and login to the GUI * add tip for registering a GitHub OAuth application * at startup of Gitea register all configured providers and also on adding/deleting of new providers * custom handling of errors in oauth2 request init + show better tip * add ExternalLoginUser model and migration script to add it to database * link a external account to an existing account (still need to handle wrong login and signup) and remove if user is removed * remove the linked external account from the user his settings * if user is unknown we allow him to register a new account or link it to some existing account * sign up with button on signin page (als change OAuth2Provider structure so we can store basic stuff about providers) * from gorilla/sessions docs: "Important Note: If you aren't using gorilla/mux, you need to wrap your handlers with context.ClearHandler as or else you will leak memory!" (we're using gorilla/sessions for storing oauth2 sessions) * use updated goth lib that now supports getting the OAuth2 user if the AccessToken is still valid instead of re-authenticating (prevent flooding the OAuth2 provider)
8 years ago
Oauth2 consumer (#679) * initial stuff for oauth2 login, fails on: * login button on the signIn page to start the OAuth2 flow and a callback for each provider Only GitHub is implemented for now * show login button only when the OAuth2 consumer is configured (and activated) * create macaron group for oauth2 urls * prevent net/http in modules (other then oauth2) * use a new data sessions oauth2 folder for storing the oauth2 session data * add missing 2FA when this is enabled on the user * add password option for OAuth2 user , for use with git over http and login to the GUI * add tip for registering a GitHub OAuth application * at startup of Gitea register all configured providers and also on adding/deleting of new providers * custom handling of errors in oauth2 request init + show better tip * add ExternalLoginUser model and migration script to add it to database * link a external account to an existing account (still need to handle wrong login and signup) and remove if user is removed * remove the linked external account from the user his settings * if user is unknown we allow him to register a new account or link it to some existing account * sign up with button on signin page (als change OAuth2Provider structure so we can store basic stuff about providers) * from gorilla/sessions docs: "Important Note: If you aren't using gorilla/mux, you need to wrap your handlers with context.ClearHandler as or else you will leak memory!" (we're using gorilla/sessions for storing oauth2 sessions) * use updated goth lib that now supports getting the OAuth2 user if the AccessToken is still valid instead of re-authenticating (prevent flooding the OAuth2 provider)
8 years ago
Oauth2 consumer (#679) * initial stuff for oauth2 login, fails on: * login button on the signIn page to start the OAuth2 flow and a callback for each provider Only GitHub is implemented for now * show login button only when the OAuth2 consumer is configured (and activated) * create macaron group for oauth2 urls * prevent net/http in modules (other then oauth2) * use a new data sessions oauth2 folder for storing the oauth2 session data * add missing 2FA when this is enabled on the user * add password option for OAuth2 user , for use with git over http and login to the GUI * add tip for registering a GitHub OAuth application * at startup of Gitea register all configured providers and also on adding/deleting of new providers * custom handling of errors in oauth2 request init + show better tip * add ExternalLoginUser model and migration script to add it to database * link a external account to an existing account (still need to handle wrong login and signup) and remove if user is removed * remove the linked external account from the user his settings * if user is unknown we allow him to register a new account or link it to some existing account * sign up with button on signin page (als change OAuth2Provider structure so we can store basic stuff about providers) * from gorilla/sessions docs: "Important Note: If you aren't using gorilla/mux, you need to wrap your handlers with context.ClearHandler as or else you will leak memory!" (we're using gorilla/sessions for storing oauth2 sessions) * use updated goth lib that now supports getting the OAuth2 user if the AccessToken is still valid instead of re-authenticating (prevent flooding the OAuth2 provider)
8 years ago
Oauth2 consumer (#679) * initial stuff for oauth2 login, fails on: * login button on the signIn page to start the OAuth2 flow and a callback for each provider Only GitHub is implemented for now * show login button only when the OAuth2 consumer is configured (and activated) * create macaron group for oauth2 urls * prevent net/http in modules (other then oauth2) * use a new data sessions oauth2 folder for storing the oauth2 session data * add missing 2FA when this is enabled on the user * add password option for OAuth2 user , for use with git over http and login to the GUI * add tip for registering a GitHub OAuth application * at startup of Gitea register all configured providers and also on adding/deleting of new providers * custom handling of errors in oauth2 request init + show better tip * add ExternalLoginUser model and migration script to add it to database * link a external account to an existing account (still need to handle wrong login and signup) and remove if user is removed * remove the linked external account from the user his settings * if user is unknown we allow him to register a new account or link it to some existing account * sign up with button on signin page (als change OAuth2Provider structure so we can store basic stuff about providers) * from gorilla/sessions docs: "Important Note: If you aren't using gorilla/mux, you need to wrap your handlers with context.ClearHandler as or else you will leak memory!" (we're using gorilla/sessions for storing oauth2 sessions) * use updated goth lib that now supports getting the OAuth2 user if the AccessToken is still valid instead of re-authenticating (prevent flooding the OAuth2 provider)
8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <style>
  2. .full.height{background-color: #F9F9F9;}
  3. .ui.left:not(.action){ float:none;}
  4. .ui.left{ float:none;}
  5. .ui.secondary.pointing.menu{ border-bottom:none;}
  6. </style>
  7. {{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn)}}
  8. {{template "base/alert" .}}
  9. {{end}}
  10. <div class="ui centered grid">
  11. <div class="sixteen wide mobile ten wide tablet ten wide computer column">
  12. <div class="ui bottom aligned two column grid">
  13. <div class="column">
  14. <h2 class="ui header">
  15. {{if .LinkAccountMode}}
  16. {{.i18n.Tr "auth.oauth_signin_title"}}
  17. {{else}}
  18. {{.i18n.Tr "auth.login_userpass"}}
  19. {{end}}
  20. </h2>
  21. </div>
  22. {{if .ShowRegistrationButton}}
  23. <div class="ui right floated column">
  24. <a href="{{AppSubUrl}}/user/sign_up">{{.i18n.Tr "auth.sign_up_now" | Str2html}}</a>
  25. </div>
  26. {{end}}
  27. </div>
  28. <div class="ui grid">
  29. <div class="column">
  30. {{if .IsCourse}}
  31. <form class="ui form" action="{{.SignInLink}}?course=true" method="post">
  32. {{else}}
  33. <form class="ui form" action="{{.SignInLink}}" method="post">
  34. {{end}}
  35. {{.CsrfTokenHtml}}
  36. <div class="field">
  37. <div class="ui left icon input {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
  38. <i class="user icon"></i>
  39. <input id="user_name" name="user_name" value="{{.user_name}}" placeholder="{{.i18n.Tr "home.login_uname_holder"}}" autofocus required>
  40. </div>
  41. </div>
  42. {{if or (not .DisablePassword) .LinkAccountMode}}
  43. <div class="field">
  44. <div class="ui left icon input {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
  45. <i class="lock icon"></i>
  46. <input id="password" name="password" type="password" value="{{.password}}" placeholder="{{.i18n.Tr "password"}}" autocomplete="off" required>
  47. </div>
  48. </div>
  49. {{end}}
  50. {{if not .LinkAccountMode}}
  51. <div class="two fields inline">
  52. <div class="field">
  53. <div class="ui checkbox">
  54. <label>{{.i18n.Tr "auth.remember_me"}}</label>
  55. <input name="remember" type="checkbox">
  56. </div>
  57. </div>
  58. <div class="field" style="padding-right: 0; text-align: right;">
  59. <a href="{{AppSubUrl}}/user/forgot_password">{{.i18n.Tr "auth.forgot_password"}}</a>
  60. </div>
  61. </div>
  62. {{end}}
  63. <div class="ui hidden divider"></div>
  64. <div class="center aligned field">
  65. <button class="fluid large ui blue button">
  66. {{if .LinkAccountMode}}
  67. {{.i18n.Tr "auth.oauth_signin_submit"}}
  68. {{else}}
  69. {{.i18n.Tr "sign_in"}}
  70. {{end}}
  71. </button>
  72. </div>
  73. {{if and .OrderedOAuth2Names .OAuth2Providers}}
  74. <div class="ui centered grid">
  75. <div class="sixteen wide mobile ten wide tablet ten wide computer column">
  76. <div class="oauth2 center">
  77. <div id="oauth2-login-loader" class="ui disabled centered loader"></div>
  78. <div>
  79. <div id="oauth2-login-navigator">
  80. <p>{{.i18n.Tr "sign_in_with"}}</p>
  81. {{range $key := .OrderedOAuth2Names}}
  82. {{$provider := index $.OAuth2Providers $key}}
  83. <a href="{{AppSubUrl}}/user/oauth2/{{$key}}">
  84. <img
  85. alt="{{$provider.DisplayName}}{{if eq $provider.Name "openidConnect"}} ({{$key}}){{end}}"
  86. title="{{$provider.DisplayName}}{{if eq $provider.Name "openidConnect"}} ({{$key}}){{end}}"
  87. class="{{$provider.Name}}"
  88. src="{{AppSubUrl}}{{$provider.Image}}"
  89. onclick="window.onOAuthLoginClick()"
  90. ></a>
  91. {{end}}
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. {{end}}
  98. </form>
  99. </div>
  100. </div>
  101. </div>
  102. </div>