diff --git a/lib/Drupal/logintoboggan/Form/LogintobogganSettingsForm.php b/lib/Drupal/logintoboggan/Form/LogintobogganSettingsForm.php index 4fb0f24..dfbc835 100644 --- a/lib/Drupal/logintoboggan/Form/LogintobogganSettingsForm.php +++ b/lib/Drupal/logintoboggan/Form/LogintobogganSettingsForm.php @@ -56,10 +56,9 @@ class LogintobogganSettingsForm extends ConfigFormBase { '#title' => $this->t('Log in'), ); $form['login']['login_with_email'] = array( - '#type' => 'radios', + '#type' => 'checkbox', '#title' => $this->t('Allow users to login using their e-mail address'), '#default_value' => $config->get('login_with_email'), - '#options' => array($_disabled, $_enabled), '#description' => $this->t('Users will be able to enter EITHER their username OR their e-mail address to log in.'), ); @@ -76,10 +75,9 @@ class LogintobogganSettingsForm extends ConfigFormBase { ); $form['registration']['confirm_email_at_registration'] = array( - '#type' => 'radios', + '#type' => 'checkbox', '#title' => $this->t('Use two e-mail fields on registration form'), '#default_value' => $config->get('confirm_email_at_registration'), - '#options' => array($_disabled, $_enabled), '#description' => $this->t('User will have to type the same e-mail address into both fields. This helps to confirm that they\'ve typed the correct address.'), ); @@ -169,30 +167,15 @@ class LogintobogganSettingsForm extends ConfigFormBase { '#tree' => FALSE, ); - $site403 = $config->get('site_403'); - if ($site403 == '') { - $disabled = $default = '0'; - } - elseif ($site403 == 'toboggan/denied') { - $disabled = '0'; - $default = 'toboggan/denied'; - } - else { - $disabled = $default = $site403; - } - $options = array($disabled => $_disabled, 'toboggan/denied' => $_enabled); - $form['other']['site_403'] = array( - '#type' => 'radios', + '#type' => 'checkbox', '#title' => $this->t('Present login form on access denied (403)'), - '#options' => $options, - '#default_value' => $default, + '#default_value' => $config->get('site_403'), '#description' => $this->t('Anonymous users will be presented with a login form along with an access denied message.') ); $form['other']['login_successful_message'] = array( - '#type' => 'radios', + '#type' => 'checkbox', '#title' => $this->t('Display login successful message'), - '#options' => array($_disabled, $_enabled), '#default_value' => $config->get('login_successful_message'), '#description' => $this->t('If enabled, users will receive a \'Log in successful\' message upon login.') ); diff --git a/logintoboggan.info.yml b/logintoboggan.info.yml index 1238b4b..b73006f 100644 --- a/logintoboggan.info.yml +++ b/logintoboggan.info.yml @@ -1,6 +1,5 @@ name: LoginToboggan type: module description: "Improves Drupal's login system." -version: VERSION core: 8.x -configure: logintoboggan.config +configure: logintobogganform.settings diff --git a/logintoboggan.module b/logintoboggan.module index ca6f762..7b6f03b 100755 --- a/logintoboggan.module +++ b/logintoboggan.module @@ -559,6 +559,12 @@ function logintoboggan_user_login_validate($form, &$form_state) { * @ingroup logintoboggan_form */ function logintoboggan_user_register_validate($form, &$form_state) { + //Check to see whether our username matches any email address currently in the system. + if($mail = db_query("SELECT mail FROM {users} WHERE LOWER(:name) = LOWER(mail)", array( + ':name' => $form_state['values']['name'], + ))->fetchField()) { + form_set_error('name', t('This e-mail has already been taken by another user.')); + } //Check to see whether our e-mail address matches the confirm address if enabled. if (variable_get('logintoboggan_confirm_email_at_registration', 0) && isset($form_state['values']['conf_mail'])) { if ($form_state['values']['mail'] != $form_state['values']['conf_mail']) {