public function CasTestSubscriber::onPreRegister in CAS 8
Same name and namespace in other branches
- 2.x tests/modules/cas_test/src/CasTestSubscriber.php \Drupal\cas_test\CasTestSubscriber::onPreRegister()
Change the username of the user being registered.
Parameters
\Drupal\cas\Event\CasPreRegisterEvent $event: The event.
File
- tests/
modules/ cas_test/ src/ CasTestSubscriber.php, line 30
Class
- CasTestSubscriber
- Class CasTestSubscriber.
Namespace
Drupal\cas_testCode
public function onPreRegister(CasPreRegisterEvent $event) {
// Add a prefix of "testing_" to the CAS username.
$username = $event
->getDrupalUsername();
$new_username = 'testing_' . $username;
$event
->setDrupalUsername($new_username);
}