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 5.2 kB

3 years ago
3 years ago
3 years ago
2 years ago
2 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
2 years ago
2 years ago
2 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
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 invitation_tips" style="font-weight:400;font-size:14px;color:rgba(250,140,22,1);display:none;">
  38. <span>您的好友 <span class="__invitation_code__">Itx003</span> 邀请你加入启智社区AI协作平台,畅享充沛的免费算力资源!</span>
  39. </div>
  40. <div class="field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
  41. <input id="user_name" name="user_name" value="{{.user_name}}" placeholder="{{.i18n.Tr "username"}}" autofocus required>
  42. </div>
  43. <div class="field {{if .Err_Email}}error{{end}}">
  44. <input id="email" name="email" type="email" value="{{.email}}" placeholder="{{.i18n.Tr "email"}}" required>
  45. </div>
  46. {{if not .DisablePassword}}
  47. <div class="field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
  48. <input id="password" name="password" type="password" value="{{.password}}" placeholder="{{.i18n.Tr "password"}}" autocomplete="off" required>
  49. </div>
  50. <div class="field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
  51. <input id="retype" name="retype" type="password" value="{{.retype}}" placeholder="{{.i18n.Tr "re_type"}}" autocomplete="off" required>
  52. </div>
  53. {{end}}
  54. {{if and .EnableCaptcha (eq .CaptchaType "image")}}
  55. <div class="field">
  56. {{.Captcha.CreateHtml}}
  57. </div>
  58. <div class="field {{if .Err_Captcha}}error{{end}}">
  59. <input id="captcha" name="captcha" value="{{.captcha}}" placeholder="{{.i18n.Tr "captcha"}}" autocomplete="off">
  60. </div>
  61. {{end}}
  62. {{if and .EnableCaptcha (eq .CaptchaType "recaptcha")}}
  63. <div class="field required">
  64. <div class="g-recaptcha" data-sitekey="{{ .RecaptchaSitekey }}"></div>
  65. </div>
  66. {{end}}
  67. {{if .EnablePhone }}
  68. <div class="use-type" usetype="0">
  69. {{template "user/auth/phone_verify" .}}
  70. </div>
  71. {{end}}
  72. <div class="field">
  73. <div style="display:flex;">
  74. <div style="display:flex;align-items:center;">
  75. <span>推荐人</span>
  76. </div>
  77. <input style="flex:1;margin-left:12px;" id="invitation_code" name="invitation_code" value="" autocomplete="off" />
  78. </div>
  79. </div>
  80. <div class="field">
  81. <div class="ui checkbox">
  82. <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>
  83. </div>
  84. </div>
  85. <div class="ui hidden divider"></div>
  86. <div class="center aligned field">
  87. <button class="fluid large ui blue button">
  88. {{if .LinkAccountMode}}
  89. {{.i18n.Tr "auth.oauth_signup_submit"}}
  90. {{else}}
  91. {{.i18n.Tr "auth.create_new_account"}}
  92. {{end}}
  93. </button>
  94. </div>
  95. {{end}}
  96. </form>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. <script>
  104. ; (function() {
  105. var getUrlParams = function() {
  106. var url = window.location.search;
  107. var index = url.indexOf('?');
  108. var obj = {};
  109. if (index !== -1) {
  110. var str = url.substr(1);
  111. var arr = str.split('&');
  112. for (var i = 0, iLen = arr.length; i < iLen; i++) {
  113. var list = arr[i].split('=');
  114. obj[list[0]] = list[1];
  115. }
  116. }
  117. return obj;
  118. };
  119. var sharedUser = getUrlParams()['sharedUser'];
  120. if (sharedUser) {
  121. setTimeout(function() {
  122. $('.invitation_tips').show().find('.__invitation_code__').text(sharedUser);
  123. $('input#invitation_code').val(sharedUser).attr('disabled', true);
  124. }, 20);
  125. }
  126. })();
  127. </script>