Commit 3528e1ee authored by Bojan Bogdanovic's avatar Bojan Bogdanovic
Browse files

Issue #3131666: t() calls should be avoided in classes, use...

Issue #3131666: t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
parent 625cf115
Loading
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ namespace Drupal\simple_oauth\Authentication\Provider;

use Drupal\Core\Authentication\AuthenticationProviderInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\simple_oauth\Authentication\TokenAuthUser;
use Drupal\simple_oauth\PageCache\SimpleOauthRequestPolicyInterface;
use Drupal\simple_oauth\Server\ResourceServerInterface;
@@ -16,6 +17,8 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
 */
class SimpleOauthAuthenticationProvider implements AuthenticationProviderInterface {

  use StringTranslationTrait;

  /**
   * @var \Drupal\simple_oauth\Server\ResourceServerInterface
   */
@@ -97,7 +100,7 @@ class SimpleOauthAuthenticationProvider implements AuthenticationProviderInterfa
      $token->revoke();
      $token->save();
      $exception = OAuthServerException::accessDenied(
        t(
        $this->t(
          '%name is blocked or has not been activated yet.',
          ['%name' => $account->getAccountName()]
        )
+4 −4
Original line number Diff line number Diff line
@@ -124,8 +124,8 @@ class Oauth2TokenSettingsForm extends ConfigFormBase {
    ];
    $form['authorization_code_expiration'] = [
      '#type' => 'number',
      '#title' => t('Authorization code expiration time'),
      '#description' => t('The default value, in seconds, to be used as expiration time when creating new authorization codes. If you are not sure about this value, use the same value as above for <em>Access token expiration time</em>.'),
      '#title' => $this->t('Authorization code expiration time'),
      '#description' => $this->t('The default value, in seconds, to be used as expiration time when creating new authorization codes. If you are not sure about this value, use the same value as above for <em>Access token expiration time</em>.'),
      '#default_value' => \Drupal::config('simple_oauth.settings')
        ->get('authorization_code_expiration'),
      '#weight' => 0,
@@ -203,8 +203,8 @@ class Oauth2TokenSettingsForm extends ConfigFormBase {
    }
    $form['use_implicit'] = [
      '#type' => 'checkbox',
      '#title' => t('Enable the implicit grant?'),
      '#description' => t('The implicit grant has the potential to be used in an insecure way. Only enable this if you understand the risks. See https://tools.ietf.org/html/rfc6819#section-4.4.2 for more information.'),
      '#title' => $this->t('Enable the implicit grant?'),
      '#description' => $this->t('The implicit grant has the potential to be used in an insecure way. Only enable this if you understand the risks. See https://tools.ietf.org/html/rfc6819#section-4.4.2 for more information.'),
      '#default_value' => \Drupal::config('simple_oauth.settings')->get('use_implicit'),
    ];