public static function RouteSubscriber::validateResetPasswordAllowed in Lightweight Directory Access Protocol (LDAP) 8.4
Same name and namespace in other branches
- 8.3 ldap_authentication/src/Routing/RouteSubscriber.php \Drupal\ldap_authentication\Routing\RouteSubscriber::validateResetPasswordAllowed()
Checks whether password reset is allowed.
Return value
\Drupal\Core\Access\AccessResultInterface Show password or not.
File
- ldap_authentication/
src/ Routing/ RouteSubscriber.php, line 34
Class
- RouteSubscriber
- Authentication route subscriber.
Namespace
Drupal\ldap_authentication\RoutingCode
public static function validateResetPasswordAllowed() : AccessResultInterface {
$config = \Drupal::config('ldap_authentication.settings');
if (\Drupal::currentUser()
->isAnonymous()) {
if ($config
->get('authenticationMode') === 'mixed') {
return AccessResult::allowed();
}
// Hide reset password for anonymous users if LDAP-only authentication and
// password updates are disabled, otherwise show.
if ($config
->get('passwordOption') === 'allow') {
return AccessResult::allowed();
}
}
return AccessResult::forbidden();
}