Commit 955b3d61 authored by zorn's avatar zorn

Some tweaks for prevent_create_email_exists

parent 804806b3
......@@ -5,7 +5,7 @@
<name>Social Login</name>
<summary>Social login via OAuth or OpenID</summary>
<description></description>
<version>1.9.5</version>
<version>1.10.0</version>
<licence>agpl</licence>
<author>zorn-v</author>
<namespace>SocialLogin</namespace>
......
......@@ -20,6 +20,14 @@ jQuery(function ($) {
});
});
$('#disable_registration').change(function () {
if (this.checked) {
$('#prevent_create_email_exists').attr('disabled', true);
} else {
$('#prevent_create_email_exists').attr('disabled', false);
}
}).change();
initProviderType('openid');
initProviderType('custom_oidc');
initProviderType('custom_oauth2');
......
......@@ -15,6 +15,8 @@
"Social login connect": "Привязки социальных логинов",
"Available providers": "Доступные поставщики",
"Social login connect is disabled": "Привязки социальных логинов отключены",
"Email already registered": "Пользователь с таким email уже зарегистрирован",
"Prevent creating an account if the email address exists in another account": "Не позволять создавать аккаунт, если пользователь с таким email адресом уже существует",
"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);"
}
......@@ -248,9 +248,11 @@ class LoginController extends Controller
if ($this->config->getAppValue($this->appName, 'disable_registration')) {
throw new LoginException($this->l->t('Auto creating new users is disabled'));
}
if ($this->config->getAppValue($this->appName, 'prevent_create_email_exists') &&
count($this->userManager->getByEmail($profile->email)) !== 0) {
throw new LoginException($this->l->t('Email already registered'));
if (
$this->config->getAppValue($this->appName, 'prevent_create_email_exists')
&& count($this->userManager->getByEmail($profile->email)) !== 0
) {
throw new LoginException($this->l->t('Email already registered'));
}
$password = substr(base64_encode(random_bytes(64)), 0, 30);
$user = $this->userManager->createUser($uid, $password);
......
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