Skip to content

Commit 8afc31b

Browse files
committed
show real callback URL for auth source
1 parent 8e9f5e1 commit 8afc31b

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

options/locale/locale_en-US.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2901,7 +2901,7 @@ auths.sspi_default_language = Default user language
29012901
auths.sspi_default_language_helper = Default language for users automatically created by SSPI auth method. Leave empty if you prefer language to be automatically detected.
29022902
auths.tips = Tips
29032903
auths.tips.oauth2.general = OAuth2 Authentication
2904-
auths.tips.oauth2.general.tip = When registering a new OAuth2 authentication, the callback/redirect URL should be: <host>/user/oauth2/<Authentication Name>/callback
2904+
auths.tips.oauth2.general.tip = When registering a new OAuth2 authentication, the callback/redirect URL should be:
29052905
auths.tip.oauth2_provider = OAuth2 Provider
29062906
auths.tip.bitbucket = Register a new OAuth consumer on https://bitbucket.org/account/user/<your username>/oauth-consumers/new and add the permission 'Account' - 'Read'
29072907
auths.tip.nextcloud = Register a new OAuth consumer on your instance using the following menu "Settings -> Security -> OAuth 2.0 client"

templates/admin/auth/edit.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<span>{{.Source.TypeName}}</span>
1515
</div>
1616
<div class="required inline field {{if .Err_Name}}error{{end}}">
17-
<label for="name">{{.locale.Tr "admin.auths.auth_name"}}</label>
18-
<input id="name" name="name" value="{{.Source.Name}}" autofocus required>
17+
<label for="auth_name">{{.locale.Tr "admin.auths.auth_name"}}</label>
18+
<input id="auth_name" name="name" value="{{.Source.Name}}" autofocus required>
1919
</div>
2020

2121
<!-- LDAP and DLDAP -->
@@ -442,8 +442,8 @@
442442
<h5>GMail Settings:</h5>
443443
<p>Host: smtp.gmail.com, Port: 587, Enable TLS Encryption: true</p>
444444

445-
<h5>{{.locale.Tr "admin.auths.tips.oauth2.general"}}:</h5>
446-
<p>{{.locale.Tr "admin.auths.tips.oauth2.general.tip"}}</p>
445+
<h5 class="oauth2">{{.locale.Tr "admin.auths.tips.oauth2.general"}}:</h5>
446+
<p class="oauth2">{{.locale.Tr "admin.auths.tips.oauth2.general.tip"}} <b id="oauth2-callback-url"></b></p>
447447
</div>
448448
</div>
449449

templates/admin/auth/new.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
</div>
2323
</div>
2424
<div class="required inline field {{if .Err_Name}}error{{end}}">
25-
<label for="name">{{.locale.Tr "admin.auths.auth_name"}}</label>
26-
<input id="name" name="name" value="{{.name}}" autofocus required>
25+
<label for="auth_name">{{.locale.Tr "admin.auths.auth_name"}}</label>
26+
<input id="auth_name" name="name" value="{{.name}}" autofocus required>
2727
</div>
2828

2929
<!-- LDAP and DLDAP -->
@@ -85,8 +85,8 @@
8585
<h5>GMail Settings:</h5>
8686
<p>Host: smtp.gmail.com, Port: 587, Enable TLS Encryption: true</p>
8787

88-
<h5>{{.locale.Tr "admin.auths.tips.oauth2.general"}}:</h5>
89-
<p>{{.locale.Tr "admin.auths.tips.oauth2.general.tip"}}</p>
88+
<h5 class="oauth2">{{.locale.Tr "admin.auths.tips.oauth2.general"}}:</h5>
89+
<p class="oauth2">{{.locale.Tr "admin.auths.tips.oauth2.general.tip"}} <b id="oauth2-callback-url"></b></p>
9090

9191
<h5 class="ui top attached header">{{.locale.Tr "admin.auths.tip.oauth2_provider"}}</h5>
9292
<div class="ui attached segment">

web_src/js/features/admin/common.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ export function initAdminCommon() {
171171
}
172172
}
173173

174+
if ($('.admin.authentication').length > 0) {
175+
$('#auth_name').on('input', function () {
176+
$('#oauth2-callback-url').text(`${window.location.origin}/user/oauth2/${encodeURIComponent($(this).val())}/callback`);
177+
}).trigger('input');
178+
}
179+
174180
// Notice
175181
if ($('.admin.notice')) {
176182
const $detailModal = $('#detail-modal');

0 commit comments

Comments
 (0)