Skip to content

Commit

Permalink
Display each OAuth providers redirect URL & misc fixes to template (N…
Browse files Browse the repository at this point in the history
…amelessMC#3014)

* Display each OAuth providers redirect URL & misc fixes to template

* Use URL::build to build OAuth URL

Co-authored-by: Sam <samerton@users.noreply.github.com>
  • Loading branch information
tadhgboyle and samerton authored Aug 13, 2022
1 parent be5c947 commit 49ba64f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
3 changes: 3 additions & 0 deletions custom/languages/en_UK.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
"admin/captcha_type": "Captcha Type",
"admin/check_again": "Check again",
"admin/clear_cache": "Clear Template Cache",
"admin/client_id": "Client ID",
"admin/client_secret": "Client Secret",
"admin/closable": "Closable",
"admin/config_not_writable": "Your core\/config.php file is not writable. Please check file permissions.",
"admin/configuration": "Configuration",
Expand Down Expand Up @@ -501,6 +503,7 @@
"admin/reaction_deleted_successfully": "Reaction deleted successfully.",
"admin/reaction_edited_successfully": "Reaction edited successfully.",
"admin/reason": "Ban Reason",
"admin/redirect_url": "Redirect URL",
"admin/recent_users": "New Users",
"admin/register_hook_info": "User registration",
"admin/registered": "Registered",
Expand Down
18 changes: 12 additions & 6 deletions custom/panel_templates/Default/core/registration.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,23 @@
</div>

<div class="form-group">
<label for="client-id-discord">Client ID</label>
<label for="client-id-{$provider_name}">{$CLIENT_ID}</label>
<input type="text" name="client-id-{$provider_name}" class="form-control"
id="client-id-{$provider_name}" placeholder="Client ID"
value="{$provider_data['client_id']}">
id="client-id-{$provider_name}" placeholder="Client ID"
value="{$provider_data['client_id']}">
</div>

<div class="form-group">
<label for="client-secret-discord">Client Secret</label>
<label for="client-secret-{$provider_name}">{$CLIENT_SECRET}</label>
<input type="password" name="client-secret-{$provider_name}"
class="form-control" id="client-secret-{$provider_name}"
placeholder="Client Secret" value="{$provider_data['client_secret']}">
class="form-control" id="client-secret-{$provider_name}"
placeholder="Client Secret" value="{$provider_data['client_secret']}">
</div>

<div class="form-group">
<label for="client-url-{$provider_name}">{$REDIRECT_URL}</label>
<input type="text" class="form-control" id="client-url-{$provider_name}"
readonly value="{$OAUTH_URL|replace:'{{provider}}':$provider_name}">
</div>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions modules/Core/pages/panel/registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@
'docLinkStart' => '<a href="https://docs.namelessmc.com/en/oauth" target="_blank">',
'docLinkEnd' => '</a>'
]),
'REDIRECT_URL' => $language->get('admin', 'redirect_url'),
'CLIENT_ID' => $language->get('admin', 'client_id'),
'CLIENT_SECRET' => $language->get('admin', 'client_secret'),
'OAUTH_URL' => URL::getSelfURL() . ltrim(URL::build('/oauth/', 'provider={{provider}}'), '/'),
'PARENT_PAGE' => PARENT_PAGE,
'DASHBOARD' => $language->get('admin', 'dashboard'),
'CONFIGURATION' => $language->get('admin', 'configuration'),
Expand Down

0 comments on commit 49ba64f

Please sign in to comment.