Commit 7594fb4c authored by zorn's avatar zorn

Allow login only from specified domain for google provider

parent 5c9cc29b
......@@ -14,6 +14,8 @@ You can create app by followed urls. You can copy link of certain login button t
* [GitHub](https://github.com/settings/developers)
* [Discord](https://discordapp.com/developers/applications/me#top)
Details about "Allow login only from specified domain" google setting you can find here [#44](https://github.com/zorn-v/nextcloud-social-login/issues/44)
Custom providers is on your own. Officially not supported
## Config
......
......@@ -17,6 +17,7 @@
"Social login connect is disabled": "Привязки социальных логинов отключены",
"Email already registered": "Пользователь с таким email уже зарегистрирован",
"Prevent creating an account if the email address exists in another account": "Не позволять создавать аккаунт, если пользователь с таким email адресом уже существует",
"Allow login only from specified domain": "Позволять вход только с указаного домена",
"Disable password confirmation on settings change": "Отключить подтверждение паролем изменения настроек"
},"pluralForm" :"nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);"
}
......@@ -100,6 +100,9 @@ class LoginController extends Controller
if (isset($scopes[$provider])) {
$config['scope'] = $scopes[$provider];
}
if (!empty($prov['auth_params'])) {
$config['authorize_url_parameters'] = $prov['auth_params'];
}
break;
}
}
......
......@@ -39,8 +39,8 @@ class AdminSettings implements ISettings
'prevent_create_email_exists',
];
$oauthProviders = [
'facebook',
'google',
'facebook',
'twitter',
'GitHub',
'discord',
......
......@@ -127,6 +127,7 @@ $providersData = [
?>
<div id="sociallogin" class="section">
<form id="sociallogin_settings" action="<?php print_unescaped($_['action_url']) ?>" method="post">
<p>
<label for="new_user_group"><?php p($l->t('Default group that all new users belong')); ?></label>
<select id="new_user_group" name="new_user_group">
......@@ -148,6 +149,7 @@ $providersData = [
<label for="prevent_create_email_exists"><?php p($l->t('Prevent creating an account if the email address exists in another account')) ?></label>
</div>
</p>
<button><?php p($l->t('Save')); ?></button>
<hr/>
<?php foreach ($_['providers'] as $name => $provider): ?>
<div class="provider-settings">
......@@ -161,6 +163,13 @@ $providersData = [
<?php p($l->t('Secret')) ?><br>
<input type="password" name="providers[<?php p($name) ?>][secret]" value="<?php p($provider['secret']) ?>"/>
</label>
<?php if ($name === 'google'): ?>
<br/>
<label>
<?php p($l->t('Allow login only from specified domain')) ?><br>
<input type="text" name="providers[<?php p($name) ?>][auth_params][hd]" value="<?php p(isset($provider['auth_params']['hd']) ? $provider['auth_params']['hd'] : '') ?>"/>
</label>
<?php endif ?>
</div>
<?php endforeach ?>
<br/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment