Commit 1a8d1022 authored by Peter Edens's avatar Peter Edens Committed by zorn-v

prevent creating account if email exists

parent d0b3599e
......@@ -248,6 +248,9 @@ 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 (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