Example #1
0
 /** @return \cubiclab\users\UsersCube|null Module instance */
 public function getModule()
 {
     if ($this->_module === null) {
         $module = UsersCube::getInstance();
         if ($module instanceof UsersCube) {
             $this->_module = $module;
         } else {
             $this->_module = Yii::$app->getModule('users');
         }
     }
     return $this->_module;
 }
Example #2
0
 public function sendEmailConfirmation($userToken)
 {
     // modify view path to module views
     $mailer = Yii::$app->mailer;
     $oldViewPath = $mailer->viewPath;
     $mailer->viewPath = $this->module->emailViewPath;
     // send email
     $email = $userToken->data ?: $this->email;
     $subject = Yii::$app->id . " - " . UsersCube::t('userscube', 'EMAIL_CONFIRMATION');
     $result = $mailer->compose('confirmEmail', compact("subject", "user", "userToken"))->setTo($email)->setSubject($subject)->send();
     // restore view path and return result
     $mailer->viewPath = $oldViewPath;
     return $result;
 }
Example #3
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => UsersCube::t('userscube', 'ATTR_ID'), 'user_id' => UsersCube::t('userscube', 'ATTR_USER_ID'), 'type' => UsersCube::t('userscube', 'ATTR_TOKEN_TYPE'), 'token' => UsersCube::t('userscube', 'ATTR_TOKEN'), 'data' => UsersCube::t('userscube', 'ATTR_TOKEN_DATA'), 'created_at' => UsersCube::t('userscube', 'ATTR_CREATED_AT'), 'expired_at' => UsersCube::t('userscube', 'ATTR_UPDATED_AT')];
 }
Example #4
0
<?php

/**
 * Created by PhpStorm.
 * User: Pt1c
 * Date: 15.11.2015
 * Time: 19:11
 */
use yii\helpers\Url;
use cubiclab\users\UsersCube;
?>

<h3><?php 
echo $subject;
?>
</h3>

<p><?php 
echo UsersCube::t('userscube', 'MAIL_CONFIRMATION_BODY');
?>
</p>

<p><?php 
echo Url::toRoute(["/user/confirm", "token" => $userToken->token], true);
?>
</p>
Example #5
0
 public static function t($category, $message, $params = [], $language = null)
 {
     UsersCube::registerTranslations();
     return Yii::t($category, $message, $params, $language);
 }