Skip to content

Commit

Permalink
fix fake email generation use real hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
Liviu Calin committed Nov 13, 2024
1 parent 5ce70e7 commit 6743cf7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion UsuarioLdapComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,12 @@ public function events() {
// Gets the email from the ldap user
$user->email = $ldap_user->getEmail();
if (empty($user->email)) {
$user->email = uniqid() . "@" . Yii::$app->request->hostName;
$hostName = Yii::$app->request->hostName;
if (strpos($hostName, '.') === false) {
// usefull in case we are in localhost for passing email validator when 'checkDNS' => true
$hostName = $hostName.'.com';
}
$user->email = uniqid() . "@" . $hostName;
}
$user->confirmed_at = time();
$user->password_hash = 'x';
Expand Down

0 comments on commit 6743cf7

Please sign in to comment.