Question

It is documented how to configure zfcUser to allow the username field on the registration form, and allow the user to login with either username or email.

However, I want to allow a user to register with username only, not require an email address for registration.

Is this configurable, or does it require overriding and re-implementing some fundamental zfcUser classes?

If so, any pointers where to start?

Thanks.

Was it helpful?

Solution

according to https://github.com/ZF-Commons/ZfcUser

you must change 'auth_identity_fields' => array( 'email' ),'enable_username' => false,

to 'auth_identity_fields' => array( 'username' ),'enable_username' => true,

auth_identity_fields - Array value, specifies which fields a user can use as the 'identity' field when logging in. Acceptable values: username, email.

next overwrite RegisterFilter of ZfcUser and make email not required to do this you must add zfcuser_register_form key in module.config.php with your verison of Register Form and RegisterFilter

You probably need to change UserController.php as well to do this add zfcuser to module.config.php like this

'controllers' => array(
        'invokables' => array(
            'zfcuser' => 'Application\Controller\UserController',
        ),
 ),

UserController is your version of that controller and of course you need your own UserEntity for all that (not sure is that true but it's better have one)

It's not complete solution but i hope it help little

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top