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.

new.tmpl 4.3 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)
9 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. {{template "base/head" .}}
  2. <div class="admin new authentication">
  3. {{template "admin/navbar" .}}
  4. <div class="ui container">
  5. {{template "base/alert" .}}
  6. <h4 class="ui top attached header">
  7. {{.i18n.Tr "admin.auths.new"}}
  8. </h4>
  9. <div class="ui attached segment">
  10. <form class="ui form" action="{{.Link}}" method="post">
  11. {{.CsrfTokenHtml}}
  12. <!-- Types and name -->
  13. <div class="inline required field {{if .Err_Type}}error{{end}}">
  14. <label>{{.i18n.Tr "admin.auths.auth_type"}}</label>
  15. <div class="ui selection type dropdown">
  16. <input type="hidden" id="auth_type" name="type" value="{{.type}}">
  17. <div class="text">{{.CurrentTypeName}}</div>
  18. <i class="dropdown icon"></i>
  19. <div class="menu">
  20. {{range .AuthSources}}
  21. <div class="item" data-value="{{.Type}}">{{.Name}}</div>
  22. {{end}}
  23. </div>
  24. </div>
  25. </div>
  26. <div class="required inline field {{if .Err_Name}}error{{end}}">
  27. <label for="name">{{.i18n.Tr "admin.auths.auth_name"}}</label>
  28. <input id="name" name="name" value="{{.name}}" autofocus required>
  29. </div>
  30. <!-- LDAP and DLDAP -->
  31. {{ template "admin/auth/source/ldap" . }}
  32. <!-- SMTP -->
  33. {{ template "admin/auth/source/smtp" . }}
  34. <!-- PAM -->
  35. <div class="pam required field {{if not (eq .type 4)}}hide{{end}}">
  36. <label for="pam_service_name">{{.i18n.Tr "admin.auths.pam_service_name"}}</label>
  37. <input id="pam_service_name" name="pam_service_name" value="{{.pam_service_name}}" />
  38. </div>
  39. <!-- OAuth2 -->
  40. {{ template "admin/auth/source/oauth" . }}
  41. <div class="ldap field">
  42. <div class="ui checkbox">
  43. <label><strong>{{.i18n.Tr "admin.auths.attributes_in_bind"}}</strong></label>
  44. <input name="attributes_in_bind" type="checkbox" {{if .attributes_in_bind}}checked{{end}}>
  45. </div>
  46. </div>
  47. <div class="smtp inline field {{if not (eq .type 3)}}hide{{end}}">
  48. <div class="ui checkbox">
  49. <label><strong>{{.i18n.Tr "admin.auths.enable_tls"}}</strong></label>
  50. <input name="tls" type="checkbox" {{if .tls}}checked{{end}}>
  51. </div>
  52. </div>
  53. <div class="has-tls inline field {{if not .HasTLS}}hide{{end}}">
  54. <div class="ui checkbox">
  55. <label><strong>{{.i18n.Tr "admin.auths.skip_tls_verify"}}</strong></label>
  56. <input name="skip_verify" type="checkbox" {{if .skip_verify}}checked{{end}}>
  57. </div>
  58. </div>
  59. <div class="ldap inline field {{if not (eq .type 2)}}hide{{end}}">
  60. <div class="ui checkbox">
  61. <label><strong>{{.i18n.Tr "admin.auths.syncenabled"}}</strong></label>
  62. <input name="is_sync_enabled" type="checkbox" {{if .is_sync_enabled}}checked{{end}}>
  63. </div>
  64. </div>
  65. <div class="inline field">
  66. <div class="ui checkbox">
  67. <label><strong>{{.i18n.Tr "admin.auths.activated"}}</strong></label>
  68. <input name="is_active" type="checkbox" {{if .is_active}}checked{{end}}>
  69. </div>
  70. </div>
  71. <div class="field">
  72. <button class="ui green button">{{.i18n.Tr "admin.auths.new"}}</button>
  73. </div>
  74. </form>
  75. </div>
  76. <h4 class="ui top attached header">
  77. {{.i18n.Tr "admin.auths.tips"}}
  78. </h4>
  79. <div class="ui attached segment">
  80. <h5>GMail Settings:</h5>
  81. <p>Host: smtp.gmail.com, Port: 587, Enable TLS Encryption: true</p>
  82. <h5>{{.i18n.Tr "admin.auths.tips.oauth2.general"}}:</h5>
  83. <p>{{.i18n.Tr "admin.auths.tips.oauth2.general.tip"}}</p>
  84. <h5 class="ui top attached header">{{.i18n.Tr "admin.auths.tip.oauth2_provider"}}</h5>
  85. <div class="ui attached segment">
  86. <li>Bitbucket</li>
  87. <span>{{.i18n.Tr "admin.auths.tip.bitbucket"}}</span>
  88. <li>Dropbox</li>
  89. <span>{{.i18n.Tr "admin.auths.tip.dropbox"}}</span>
  90. <li>Facebook</li>
  91. <span>{{.i18n.Tr "admin.auths.tip.facebook"}}</span>
  92. <li>GitHub</li>
  93. <span>{{.i18n.Tr "admin.auths.tip.github"}}</span>
  94. <li>GitLab</li>
  95. <span>{{.i18n.Tr "admin.auths.tip.gitlab"}}</span>
  96. <li>Google+</li>
  97. <span>{{.i18n.Tr "admin.auths.tip.google_plus"}}</span>
  98. <li>OpenID Connect</li>
  99. <span>{{.i18n.Tr "admin.auths.tip.openid_connect"}}</span>
  100. <li>Twitter</li>
  101. <span>{{.i18n.Tr "admin.auths.tip.twitter"}}</span>
  102. <li>Discord</li>
  103. <span>{{.i18n.Tr "admin.auths.tip.discord"}}</span>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. {{template "base/footer" .}}