Comments

StefanPr created an issue. See original summary.

StefanPr’s picture

Status: Active » Needs review
StatusFileSize
new1.27 KB
StefanPr’s picture

Assigned: StefanPr » Unassigned
benjy’s picture

+1 for this.

+++ b/email_registration.module
@@ -119,13 +120,18 @@ function email_registration_cleanup_username($name) {
+  $form_object = $form_state->getFormObject();
+  $class = AccountForm::class;
+  if (is_subclass_of($form_object, $class) || is_a($form_object, $class)) {
...
+  }
 }

This could probably have been done by simply checking the form_id, also a little safer in case someone is extending/using the AccountForm for anything else.

andypost’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

Please update summary why that change could be useful

Registration form defined in user entity annotation so could be overriden but I do not like non-specific hook_form_alter() cos it will fire for every form on site

+++ b/email_registration.module
@@ -119,13 +120,18 @@ function email_registration_cleanup_username($name) {
-  $form['account']['mail']['#title'] = t('E-mail');
...
+    $form['account']['mail']['#title'] = t('E-mail');

will be affected by #2864902: Update "e-mail" to "email" across all files

qichanghai’s picture

Status: Needs work » Needs review
StatusFileSize
new1.1 KB

Here is a patch which implements hook_user_form_alter() instead of hook_form_alter().

qichanghai’s picture

Issue summary: View changes

Status: Needs review » Needs work
qichanghai’s picture

StatusFileSize
new1.11 KB

New patch since the previous one failed to apply.

qichanghai’s picture

Status: Needs work » Needs review
qichanghai’s picture

andypost’s picture

It looks great except I'm not sure that Registration Types module & other custom implementations will not inherit their forms from the core's class

mistrae’s picture

The patch remove the email_registration_form_user_register_form_alter function and add email_registration_form_user_form_alter function, but the user form alter already exist line 181. It creates an error

andypost’s picture

Status: Needs review » Needs work

needs work for #13

m.abdulqader’s picture

Only changing the form ID to Form Base will make this module work with form mode manager.

m.abdulqader’s picture

Change hook to BASE_FORM to support form mode manager module.

andypost’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
greggles’s picture

Status: Needs work » Needs review
StatusFileSize
new714 bytes

This is a straight reroll of #16 since DrupalCI seems to be mad about something in that one.

Status: Needs review » Needs work
greggles’s picture

Status: Needs work » Needs review
StatusFileSize
new713 bytes

OK, let's try this again :) Still just a reroll of #16 to remove fuzz of one line.

  • greggles committed 23596fe on 8.x-1.x authored by m.abdulqader
    Issue #2919733 by qichanghai, greggles, StefanPr, m.abdulqader, andypost...
greggles’s picture

Status: Needs review » Fixed

OK - now fixed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

greggles’s picture

This issue seems to have caused a regression - see #3024558: Username regenerated improperly after rc6 release.