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.

signup_inner.tmpl 3.9 kB

3 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
3 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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <style>
  2. .full.height{background-color: #F9F9F9;}
  3. </style>
  4. <div class="ui container very padded {{if .LinkAccountMode}} icon{{end}}" style=" padding-top: 5.0rem; padding-bottom: 3.0rem;">
  5. <div class="ui raised very padded text container segment">
  6. <div class="ui centered grid">
  7. <div class="sixteen wide mobile ten wide tablet ten wide computer column">
  8. <div class="ui bottom aligned two column grid">
  9. <div class="column">
  10. <h2 class="ui header">
  11. {{if .LinkAccountMode}}
  12. {{.i18n.Tr "auth.oauth_signup_title"}}
  13. {{else}}
  14. {{.i18n.Tr "sign_up"}}
  15. {{end}}
  16. </h2>
  17. </div>
  18. {{if not .LinkAccountMode}}
  19. <div class="ui right floated column">
  20. <a href="{{AppSubUrl}}/user/login">{{.i18n.Tr "auth.register_helper_msg"}}</a>
  21. </div>
  22. {{end}}
  23. </div>
  24. <div class="ui grid">
  25. <div class="column">
  26. <form class="ui form" action="{{.SignUpLink}}" method="post">
  27. {{.CsrfTokenHtml}}
  28. {{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister)}}
  29. {{template "base/alert" .}}
  30. {{end}}
  31. <div class="ui negative message" style="display:none;">
  32. <p></p>
  33. </div>
  34. {{if .DisableRegistration}}
  35. <p>{{.i18n.Tr "auth.disable_register_prompt"}}</p>
  36. {{else}}
  37. <div class="field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
  38. <input id="user_name" name="user_name" value="{{.user_name}}" placeholder="{{.i18n.Tr "username"}}" autofocus required>
  39. </div>
  40. <div class="field {{if .Err_Email}}error{{end}}">
  41. <input id="email" name="email" type="email" value="{{.email}}" placeholder="{{.i18n.Tr "email"}}" required>
  42. </div>
  43. {{if not .DisablePassword}}
  44. <div class="field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
  45. <input id="password" name="password" type="password" value="{{.password}}" placeholder="{{.i18n.Tr "password"}}" autocomplete="off" required>
  46. </div>
  47. <div class="field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
  48. <input id="retype" name="retype" type="password" value="{{.retype}}" placeholder="{{.i18n.Tr "re_type"}}" autocomplete="off" required>
  49. </div>
  50. {{end}}
  51. {{if and .EnableCaptcha (eq .CaptchaType "image")}}
  52. <div class="field">
  53. {{.Captcha.CreateHtml}}
  54. </div>
  55. <div class="field {{if .Err_Captcha}}error{{end}}">
  56. <input id="captcha" name="captcha" value="{{.captcha}}" placeholder="{{.i18n.Tr "captcha"}}" autocomplete="off">
  57. </div>
  58. {{end}}
  59. {{if and .EnableCaptcha (eq .CaptchaType "recaptcha")}}
  60. <div class="field required">
  61. <div class="g-recaptcha" data-sitekey="{{ .RecaptchaSitekey }}"></div>
  62. </div>
  63. {{end}}
  64. {{if .EnablePhone }}
  65. <div class="use-type" usetype="0">
  66. {{template "user/auth/phone_verify" .}}
  67. </div>
  68. {{end}}
  69. <div class="field">
  70. <div class="ui checkbox">
  71. <input name="agree" type="checkbox" tabindex="0" class="hidden" {{if .agree}}checked{{end}}><label>{{.i18n.Tr "use_and_privacy_agree" "/home/term" "/home/privacy" | Safe}}</label>
  72. </div>
  73. </div>
  74. <div class="ui hidden divider"></div>
  75. <div class="center aligned field">
  76. <button class="fluid large ui blue button">
  77. {{if .LinkAccountMode}}
  78. {{.i18n.Tr "auth.oauth_signup_submit"}}
  79. {{else}}
  80. {{.i18n.Tr "auth.create_new_account"}}
  81. {{end}}
  82. </button>
  83. </div>
  84. {{end}}
  85. </form>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>