Additional OAuth2 providers (#1010)
* add google+ * sort signin oauth2 providers based on the name so order is always the same * update auth tip for google+ * add gitlab provider * add bitbucket provider (and some go fmt) * add twitter provider * add facebook provider * add dropbox provider * add openid connect provider incl. new format of tips section in "Add New Source" * lower the amount of disk storage for each session to prevent issues while building cross platform (and disk overflow) * imports according to goimport and code style * make it possible to set custom urls to gitlab and github provider (only these could have a different host) * split up oauth2 into multiple files * small typo in comment * fix indention * fix indentation * fix new line before external import * fix layout of signin part * update "broken" dependency
This commit is contained in:
parent
2368bbb672
commit
950f2e2074
44 changed files with 4164 additions and 159 deletions
|
@ -164,6 +164,39 @@
|
|||
<label for="oauth2_secret">{{.i18n.Tr "admin.auths.oauth2_clientSecret"}}</label>
|
||||
<input id="oauth2_secret" name="oauth2_secret" value="{{$cfg.ClientSecret}}" required>
|
||||
</div>
|
||||
<div class="open_id_connect_auto_discovery_url required field">
|
||||
<label for="open_id_connect_auto_discovery_url">{{.i18n.Tr "admin.auths.openIdConnectAutoDiscoveryURL"}}</label>
|
||||
<input id="open_id_connect_auto_discovery_url" name="open_id_connect_auto_discovery_url" value="{{$cfg.OpenIDConnectAutoDiscoveryURL}}">
|
||||
</div>
|
||||
|
||||
<div class="oauth2_use_custom_url inline field">
|
||||
<div class="ui checkbox">
|
||||
<label><strong>{{.i18n.Tr "admin.auths.oauth2_use_custom_url"}}</strong></label>
|
||||
<input id="oauth2_use_custom_url" name="oauth2_use_custom_url" type="checkbox" {{if $cfg.CustomURLMapping}}checked{{end}}>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oauth2_use_custom_url_field oauth2_auth_url required field">
|
||||
<label for="oauth2_auth_url">{{.i18n.Tr "admin.auths.oauth2_authURL"}}</label>
|
||||
<input id="oauth2_auth_url" name="oauth2_auth_url" value="{{if $cfg.CustomURLMapping}}{{$cfg.CustomURLMapping.AuthURL}}v{{end}}">
|
||||
</div>
|
||||
<div class="oauth2_use_custom_url_field oauth2_token_url required field">
|
||||
<label for="oauth2_token_url">{{.i18n.Tr "admin.auths.oauth2_tokenURL"}}</label>
|
||||
<input id="oauth2_token_url" name="oauth2_token_url" value="{{if $cfg.CustomURLMapping}}{{$cfg.CustomURLMapping.TokenURL}}{{end}}">
|
||||
</div>
|
||||
<div class="oauth2_use_custom_url_field oauth2_profile_url required field">
|
||||
<label for="oauth2_profile_url">{{.i18n.Tr "admin.auths.oauth2_profileURL"}}</label>
|
||||
<input id="oauth2_profile_url" name="oauth2_profile_url" value="{{if $cfg.CustomURLMapping}}{{$cfg.CustomURLMapping.ProfileURL}}{{end}}">
|
||||
</div>
|
||||
<div class="oauth2_use_custom_url_field oauth2_email_url required field">
|
||||
<label for="oauth2_email_url">{{.i18n.Tr "admin.auths.oauth2_emailURL"}}</label>
|
||||
<input id="oauth2_email_url" name="oauth2_email_url" value="{{if $cfg.CustomURLMapping}}{{$cfg.CustomURLMapping.EmailURL}}{{end}}">
|
||||
</div>
|
||||
{{if .OAuth2DefaultCustomURLMappings}}{{range $key, $value := .OAuth2DefaultCustomURLMappings}}
|
||||
<input id="{{$key}}_token_url" value="{{$value.TokenURL}}" type="hidden" />
|
||||
<input id="{{$key}}_auth_url" value="{{$value.AuthURL}}" type="hidden" />
|
||||
<input id="{{$key}}_profile_url" value="{{$value.ProfileURL}}" type="hidden" />
|
||||
<input id="{{$key}}_email_url" value="{{$value.EmailURL}}" type="hidden" />
|
||||
{{end}}{{end}}
|
||||
{{end}}
|
||||
|
||||
<div class="inline field {{if not .Source.IsSMTP}}hide{{end}}">
|
||||
|
|
|
@ -80,8 +80,29 @@
|
|||
<div class="ui attached segment">
|
||||
<h5>GMail Settings:</h5>
|
||||
<p>Host: smtp.gmail.com, Port: 587, Enable TLS Encryption: true</p>
|
||||
<h5>OAuth GitHub:</h5>
|
||||
<p>{{.i18n.Tr "admin.auths.tip.github"}}</p>
|
||||
|
||||
<h5>{{.i18n.Tr "admin.auths.tips.oauth2.general"}}:</h5>
|
||||
<p>{{.i18n.Tr "admin.auths.tips.oauth2.general.tip"}}</p>
|
||||
|
||||
<h5 class="ui top attached header">{{.i18n.Tr "admin.auths.tip.oauth2_provider"}}</h5>
|
||||
<div class="ui attached segment">
|
||||
<li>Bitbucket</li>
|
||||
<span>{{.i18n.Tr "admin.auths.tip.bitbucket"}}</span>
|
||||
<li>Dropbox</li>
|
||||
<span>{{.i18n.Tr "admin.auths.tip.dropbox"}}</span>
|
||||
<li>Facebook</li>
|
||||
<span>{{.i18n.Tr "admin.auths.tip.facebook"}}</span>
|
||||
<li>GitHub</li>
|
||||
<span>{{.i18n.Tr "admin.auths.tip.github"}}</span>
|
||||
<li>GitLab</li>
|
||||
<span>{{.i18n.Tr "admin.auths.tip.gitlab"}}</span>
|
||||
<li>Google+</li>
|
||||
<span>{{.i18n.Tr "admin.auths.tip.google_plus"}}</span>
|
||||
<li>OpenID Connect</li>
|
||||
<span>{{.i18n.Tr "admin.auths.tip.openid_connect"}}</span>
|
||||
<li>Twitter</li>
|
||||
<span>{{.i18n.Tr "admin.auths.tip.twitter"}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -20,4 +20,39 @@
|
|||
<label for="oauth2_secret">{{.i18n.Tr "admin.auths.oauth2_clientSecret"}}</label>
|
||||
<input id="oauth2_secret" name="oauth2_secret" value="{{.oauth2_secret}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="open_id_connect_auto_discovery_url required field">
|
||||
<label for="open_id_connect_auto_discovery_url">{{.i18n.Tr "admin.auths.openIdConnectAutoDiscoveryURL"}}</label>
|
||||
<input id="open_id_connect_auto_discovery_url" name="open_id_connect_auto_discovery_url" value="{{.open_id_connect_auto_discovery_url}}">
|
||||
</div>
|
||||
|
||||
<div class="oauth2_use_custom_url inline field">
|
||||
<div class="ui checkbox">
|
||||
<label><strong>{{.i18n.Tr "admin.auths.oauth2_use_custom_url"}}</strong></label>
|
||||
<input id="oauth2_use_custom_url" name="oauth2_use_custom_url" type="checkbox">
|
||||
</div>
|
||||
</div>
|
||||
<div class="oauth2_use_custom_url_field oauth2_auth_url required field">
|
||||
<label for="oauth2_auth_url">{{.i18n.Tr "admin.auths.oauth2_authURL"}}</label>
|
||||
<input id="oauth2_auth_url" name="oauth2_auth_url" value="{{.oauth2_auth_url}}">
|
||||
</div>
|
||||
<div class="oauth2_use_custom_url_field oauth2_token_url required field">
|
||||
<label for="oauth2_token_url">{{.i18n.Tr "admin.auths.oauth2_tokenURL"}}</label>
|
||||
<input id="oauth2_token_url" name="oauth2_token_url" value="{{.oauth2_token_url}}">
|
||||
</div>
|
||||
<div class="oauth2_use_custom_url_field oauth2_profile_url required field">
|
||||
<label for="oauth2_profile_url">{{.i18n.Tr "admin.auths.oauth2_profileURL"}}</label>
|
||||
<input id="oauth2_profile_url" name="oauth2_profile_url" value="{{.oauth2_profile_url}}">
|
||||
</div>
|
||||
<div class="oauth2_use_custom_url_field oauth2_email_url required field">
|
||||
<label for="oauth2_email_url">{{.i18n.Tr "admin.auths.oauth2_emailURL"}}</label>
|
||||
<input id="oauth2_email_url" name="oauth2_email_url" value="{{.oauth2_email_url}}">
|
||||
</div>
|
||||
{{if .OAuth2DefaultCustomURLMappings}}
|
||||
{{range $key, $value := .OAuth2DefaultCustomURLMappings}}
|
||||
<input id="{{$key}}_token_url" value="{{$value.TokenURL}}" type="hidden" />
|
||||
<input id="{{$key}}_auth_url" value="{{$value.AuthURL}}" type="hidden" />
|
||||
<input id="{{$key}}_profile_url" value="{{$value.ProfileURL}}" type="hidden" />
|
||||
<input id="{{$key}}_email_url" value="{{$value.EmailURL}}" type="hidden" />
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
|
@ -8,6 +8,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui user signin container icon">
|
||||
{{template "user/auth/signin_inner" .}}
|
||||
</div>
|
||||
{{template "user/auth/signup_inner" .}}
|
||||
{{template "base/footer" .}}
|
||||
|
|
|
@ -38,11 +38,14 @@
|
|||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if .OAuth2Providers}}
|
||||
{{if and .OrderedOAuth2Names .OAuth2Providers}}
|
||||
<div class="ui attached segment">
|
||||
<div class="oauth2 center">
|
||||
<div>
|
||||
<p>{{.i18n.Tr "sign_in_with"}}</p>{{range $key, $value := .OAuth2Providers}}<a href="{{AppSubUrl}}/user/oauth2/{{$key}}"><img alt="{{$value.DisplayName}}" title="{{$value.DisplayName}}" src="{{AppSubUrl}}{{$value.Image}}"></a>{{end}}
|
||||
<p>{{.i18n.Tr "sign_in_with"}}</p>{{range $key := .OrderedOAuth2Names}}
|
||||
{{$provider := index $.OAuth2Providers $key}}
|
||||
<a href="{{AppSubUrl}}/user/oauth2/{{$key}}"><img alt="{{$provider.DisplayName}}{{if eq $provider.Name "openidConnect"}} ({{$key}}){{end}}" title="{{$provider.DisplayName}}{{if eq $provider.Name "openidConnect"}} ({{$key}}){{end}}" class="{{$provider.Name}}" src="{{AppSubUrl}}{{$provider.Image}}"></a>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue