This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Asinox
Asinox

Hello guys, im having an issue, and i would like to ask if there is a way to generate the activation code when im using the Auth Facade:

$user = Auth::register([
    'name' => 'Some User',
    'email' => 'some@website.tld',
    'password' => 'changeme',
    'password_confirmation' => 'changeme',
]);

Eveything is fine, but i cant see the activation code generated... any idea?

Thank you

zachar
zachar

You could try: add:

use RainLab\User\Models\Settings as UserSettings;
$data = [
   'name' => 'Some User',
   'email' => 'some@website.tld',
   'password' => 'changeme',
   'password_confirmation' => 'changeme',
];
$requireActivation = UserSettings::get('require_activation', true);
$automaticActivation = UserSettings::get('activate_mode') == UserSettings::ACTIVATE_AUTO; 
$userActivation = UserSettings::get('activate_mode') == UserSettings::ACTIVATE_USER;
$user = Auth::register($data, $userActivation );

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.