public static function EmailTemplateService::profileNeedsUpdate in Lightweight Directory Access Protocol (LDAP) 8.3
Same name and namespace in other branches
- 8.4 ldap_authentication/src/Routing/EmailTemplateService.php \Drupal\ldap_authentication\Routing\EmailTemplateService::profileNeedsUpdate()
Whether or not the user's profile is valid or needs to be updated on login.
Currently this only checks if mail is valid or not according to the authentication settings.
Return value
bool TRUE if the user's profile is valid, otherwise FALSE.
2 calls to EmailTemplateService::profileNeedsUpdate()
- EmailTemplateService::checkForEmailTemplate in ldap_authentication/
src/ Routing/ EmailTemplateService.php - Form submit callback to check for an email template and redirect if needed.
- LdapAuthenticationProfileUpdateForm::buildForm in ldap_authentication/
src/ Form/ LdapAuthenticationProfileUpdateForm.php - Form constructor.
File
- ldap_authentication/
src/ Routing/ EmailTemplateService.php, line 67
Class
- EmailTemplateService
- Class EmailTemplateService.
Namespace
Drupal\ldap_authentication\RoutingCode
public static function profileNeedsUpdate() {
$proxy = \Drupal::currentUser();
$result = FALSE;
// We only want non-anonymous and non-1 users.
if ($proxy
->id() != 1 && $proxy
->isAuthenticated()) {
$user = User::load($proxy
->id());
$regex = \Drupal::config('ldap_authentication.settings')
->get('emailTemplateUsagePromptRegex');
$regex = '`' . $regex . '`i';
if (preg_match($regex, $user
->get('mail')->value)) {
$result = TRUE;
}
}
return $result;
}