You are here

interface UserEmailVerificationInterface in User email verification 8

Interface defining User email verification helper service.

Hierarchy

Expanded class hierarchy of UserEmailVerificationInterface

All classes that implement UserEmailVerificationInterface

8 files declare their use of UserEmailVerificationInterface
UserEmailVerificationBlockAccount.php in src/Plugin/QueueWorker/UserEmailVerificationBlockAccount.php
UserEmailVerificationDeleteAccount.php in src/Plugin/QueueWorker/UserEmailVerificationDeleteAccount.php
UserEmailVerificationNeeded.php in src/Cache/Context/UserEmailVerificationNeeded.php
UserEmailVerificationNotificationBlock.php in src/Plugin/Block/UserEmailVerificationNotificationBlock.php
UserEmailVerificationReminders.php in src/Plugin/QueueWorker/UserEmailVerificationReminders.php

... See full list

File

src/UserEmailVerificationInterface.php, line 10

Namespace

Drupal\user_email_verification
View source
interface UserEmailVerificationInterface {

  /**
   * Table name which contains Email verification data.
   */
  const VERIFICATION_TABLE_NAME = 'user_email_verification';

  /**
   * Queue "Block user account": Quantity of users to block by one queue item.
   */
  const QUEUE_BLOCK_ACCOUNT_LIMIT = 10;

  /**
   * Queue "Remind an user": Quantity of users to remind by one queue item.
   */
  const QUEUE_REMINDERS_LIMIT = 10;

  /**
   * Queue "Delete user account": Quantity of users to delete by one queue item.
   */
  const QUEUE_DELETE_ACCOUNT_LIMIT = 10;

  /**
   * Return email validation interval.
   *
   * @return int
   *   Validate interval time in seconds.
   */
  public function getValidateInterval();

  /**
   * Return quantity of reminders which should be used.
   *
   * @return int
   *   Reminders quantity.
   */
  public function getNumReminders();

  /**
   * Return reminder interval (in seconds).
   *
   * @return int
   *   Reminder interval (in seconds).
   */
  public function getReminderInterval();

  /**
   * Return role names which shouldn't have Email verification.
   *
   * @return array
   *   Role names to skip.
   */
  public function getSkipRoles();

  /**
   * Return extended email validation interval.
   *
   * @return int
   *   Extended validate interval time in seconds.
   */
  public function getExtendedValidateInterval();

  /**
   * Return verification mail subject.
   *
   * @return string
   *   Verification mail subject.
   */
  public function getMailSubject();

  /**
   * Return verification mail body.
   *
   * @return string
   *   Verification mail body.
   */
  public function getMailBody();

  /**
   * Return extended verification mail subject.
   *
   * @return string
   *   Extended verification mail subject.
   */
  public function getExtendedMailSubject();

  /**
   * Return extended verification mail body.
   *
   * @return string
   *   Extended verification mail body.
   */
  public function getExtendedMailBody();

  /**
   * Checks is extended period enabled or no.
   *
   * @return bool
   *   Is extended period enabled or no.
   */
  public function isExtendedPeriodEnabled();

  /**
   * Build a base-64 encoded sha-256 HMAC.
   *
   * @param int $uid
   *   User ID.
   * @param int $timestamp
   *   Timestamp value.
   *
   * @return string
   *   A base-64 encoded sha-256 hmac.
   */
  public function buildHmac($uid, $timestamp);

  /**
   * Build Email verification URL for requested user.
   *
   * @param \Drupal\user\UserInterface $user
   *   User to create email verification URL for.
   *
   * @return \Drupal\Core\Url
   *   Email verification URL.
   */
  public function buildVerificationUrl(UserInterface $user);

  /**
   * Build extended Email verification URL for requested user.
   *
   * @param \Drupal\user\UserInterface $user
   *   User to create email verification URL for.
   *
   * @return \Drupal\Core\Url
   *   Extended Email verification URL.
   */
  public function buildExtendedVerificationUrl(UserInterface $user);

  /**
   * Load verification item for requested user ID.
   *
   * @param int $uid
   *   User ID.
   *
   * @return array|false
   *   Verification item data array on success or boolean FALSE otherwise.
   */
  public function loadVerificationByUserId($uid);

  /**
   * Update verification for requested user: Set email verified.
   *
   * @param int $uid
   *   User ID.
   */
  public function setEmailVerifiedByUserId($uid);

  /**
   * Create user email verification item.
   *
   * @param \Drupal\user\UserInterface $user
   *   User to create email verification item for.
   * @param bool $verify
   *   Flag mark as verified/no on creation.
   */
  public function createVerification(UserInterface $user, $verify = FALSE);

  /**
   * Delete user email verification item.
   *
   * @param \Drupal\user\UserInterface $user
   *   User to delete email verification item for.
   */
  public function deleteVerification(UserInterface $user);

  /**
   * Handle cron related tasks.
   */
  public function cronHandler();

  /**
   * Blocks user account by ID.
   *
   * @param int $uid
   *   User ID.
   */
  public function blockUserAccountById($uid);

  /**
   * Send "Verify your Email" mail to requested user.
   *
   * @param int $uid
   *   User ID.
   *
   * @return bool
   *   Action result.
   */
  public function sendVerifyMailById($uid);

  /**
   * Send "blocked account verified Email" mail to site administrator.
   *
   * @param \Drupal\user\UserInterface $user
   *   Blocked user who verified Email.
   *
   * @return bool
   *   Action result.
   */
  public function sendVerifyBlockedMail(UserInterface $user);

  /**
   * Reminds user about verification user by ID.
   *
   * @param int $uid
   *   User ID.
   */
  public function remindUserById($uid);

  /**
   * Delete user account by ID.
   *
   * @param int $uid
   *   User ID.
   */
  public function deleteUserAccountById($uid);

  /**
   * Checks: Can we remind user right now.
   *
   * @param int $uid
   *   User ID.
   *
   * @return bool
   *   Result of check.
   */
  public function isReminderNeeded($uid);

  /**
   * Checks: Is email verification needed for a requested user.
   *
   * @param int $uid
   *   User ID, optional, if not set - current user ID will be used.
   *
   * @return bool
   *   Result of check.
   */
  public function isVerificationNeeded($uid = 0);

  /**
   * Fill email message with data. A hook_mail() handler.
   *
   * @param string $key
   *   A key to identify the email sent.
   * @param array $message
   *   A message array to be filled in.
   * @param array $params
   *   An array of message parameters.
   */
  public function initEmailMessage($key, array &$message, array $params);

  /**
   * Load Drupal user by name or email.
   *
   * @param string $name_or_email
   *   User name/login or email.
   * @param bool $active_only
   *   Whether to search for active users only.
   *
   * @return null|\Drupal\user\UserInterface
   *   Drupal user on success or NULL otherwise.
   */
  public function getUserByNameOrEmail($name_or_email, $active_only);

}

Members

Namesort descending Modifiers Type Description Overrides
UserEmailVerificationInterface::blockUserAccountById public function Blocks user account by ID. 1
UserEmailVerificationInterface::buildExtendedVerificationUrl public function Build extended Email verification URL for requested user. 1
UserEmailVerificationInterface::buildHmac public function Build a base-64 encoded sha-256 HMAC. 1
UserEmailVerificationInterface::buildVerificationUrl public function Build Email verification URL for requested user. 1
UserEmailVerificationInterface::createVerification public function Create user email verification item. 1
UserEmailVerificationInterface::cronHandler public function Handle cron related tasks. 1
UserEmailVerificationInterface::deleteUserAccountById public function Delete user account by ID. 1
UserEmailVerificationInterface::deleteVerification public function Delete user email verification item. 1
UserEmailVerificationInterface::getExtendedMailBody public function Return extended verification mail body. 1
UserEmailVerificationInterface::getExtendedMailSubject public function Return extended verification mail subject. 1
UserEmailVerificationInterface::getExtendedValidateInterval public function Return extended email validation interval. 1
UserEmailVerificationInterface::getMailBody public function Return verification mail body. 1
UserEmailVerificationInterface::getMailSubject public function Return verification mail subject. 1
UserEmailVerificationInterface::getNumReminders public function Return quantity of reminders which should be used. 1
UserEmailVerificationInterface::getReminderInterval public function Return reminder interval (in seconds). 1
UserEmailVerificationInterface::getSkipRoles public function Return role names which shouldn't have Email verification. 1
UserEmailVerificationInterface::getUserByNameOrEmail public function Load Drupal user by name or email. 1
UserEmailVerificationInterface::getValidateInterval public function Return email validation interval. 1
UserEmailVerificationInterface::initEmailMessage public function Fill email message with data. A hook_mail() handler. 1
UserEmailVerificationInterface::isExtendedPeriodEnabled public function Checks is extended period enabled or no. 1
UserEmailVerificationInterface::isReminderNeeded public function Checks: Can we remind user right now. 1
UserEmailVerificationInterface::isVerificationNeeded public function Checks: Is email verification needed for a requested user. 1
UserEmailVerificationInterface::loadVerificationByUserId public function Load verification item for requested user ID. 1
UserEmailVerificationInterface::QUEUE_BLOCK_ACCOUNT_LIMIT constant Queue "Block user account": Quantity of users to block by one queue item.
UserEmailVerificationInterface::QUEUE_DELETE_ACCOUNT_LIMIT constant Queue "Delete user account": Quantity of users to delete by one queue item.
UserEmailVerificationInterface::QUEUE_REMINDERS_LIMIT constant Queue "Remind an user": Quantity of users to remind by one queue item.
UserEmailVerificationInterface::remindUserById public function Reminds user about verification user by ID. 1
UserEmailVerificationInterface::sendVerifyBlockedMail public function Send "blocked account verified Email" mail to site administrator. 1
UserEmailVerificationInterface::sendVerifyMailById public function Send "Verify your Email" mail to requested user. 1
UserEmailVerificationInterface::setEmailVerifiedByUserId public function Update verification for requested user: Set email verified. 1
UserEmailVerificationInterface::VERIFICATION_TABLE_NAME constant Table name which contains Email verification data.