Beispiel #1
0
 /**
  * Validates email.
  */
 public function validateEmail()
 {
     $user = $this->getUser();
     if (!$user) {
         $this->addError('email', Module::t('registration', 'User with such email or username is not found.'));
     } elseif ($user->isConfirmed()) {
         $this->addError('email', Module::t('registration', 'This account has already been confirmed.'));
     }
 }
Beispiel #2
0
 /**
  * Validates email.
  */
 public function validateEmail()
 {
     $user = $this->getUser();
     if (!$user) {
         $this->addError('email', Module::t('recovery', 'User with such email or username is not found.'));
     } elseif (!$user->isConfirmed()) {
         $this->addError('email', Module::t('recovery', 'This account in not confirmed.'));
     } elseif (!$user->isActive()) {
         $this->addError('email', Module::t('recovery', 'This account in not activated.'));
     }
 }
Beispiel #3
0
 /**
  * Validates the account status.
  */
 public function validateAccount()
 {
     if (!$this->hasErrors()) {
         $user = $this->getUser();
         if ($user) {
             if (!$user->isConfirmed()) {
                 $this->addError('username', Module::t('login', 'This account in not confirmed.'));
             } elseif (!$user->isActive()) {
                 $this->addError('username', Module::t('login', 'This account in not activated.'));
             }
         }
     }
 }
 /**
  * Confirms user's account.
  *
  * @param string $token
  * @return mixed
  */
 public function actionReset($token)
 {
     $userComponent = $this->getUserComponent();
     $model = $this->getPasswordResetForm();
     $token = $userComponent->getPasswordRecoveryToken($token);
     if ($token && $token->user) {
         if ($model->load(Yii::$app->request->post()) && $model->validate()) {
             if ($userComponent->resetPassword($token->user, $model->password)) {
                 $token->delete();
                 Yii::$app->session->setFlash('reset.success', Module::t('recovery', 'The password has been changed.'));
             } else {
                 Yii::$app->session->setFlash('reset.error', Module::t('recovery', 'The password has not been changed. Please try again!'));
             }
         }
     } else {
         Yii::$app->session->setFlash('reset.token.error', Module::t('recovery', 'The recovery link is invalid or expired. Please try to request a new one.'));
     }
     return $this->render('reset', ['model' => $model]);
 }
Beispiel #5
0
            <div class="col-md-6">
                <?php 
    $form = ActiveForm::begin();
    ?>

                <?php 
    echo $form->field($model, 'password')->passwordInput();
    ?>

                <?php 
    echo $form->field($model, 'password2')->passwordInput();
    ?>

                <div class="form-group">
                    <?php 
    echo Html::submitButton(Module::t('recovery', 'Reset'), ['class' => 'btn btn-primary', 'name' => 'reset-button']);
    ?>
                </div>

                <?php 
    ActiveForm::end();
    ?>
            </div>
        </div>

    <?php 
}
?>

</div>
Beispiel #6
0
 /**
  * Return statuses list.
  *
  * @return array
  */
 public static function getStatusesList()
 {
     return [static::STATUS_INACTIVE => Module::t('users', 'Inactive'), static::STATUS_ACTIVE => Module::t('users', 'Active'), static::STATUS_DELETED => Module::t('users', 'Deleted')];
 }
?>
,
</p>
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
    <?php 
echo Module::t('registration', 'Thank you for registration on {0}', Yii::$app->name);
?>
.
    <?php 
echo Module::t('registration', 'In order to complete your registration, please click the link below');
?>
.
</p>
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
    <?php 
echo Url::to(['/users/registration/confirm', 'token' => $token->token], true);
?>
</p>
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
    <?php 
echo Module::t('registration', 'If you cannot click the link, please try pasting the text into your browser');
?>
.
</p>
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
    <?php 
echo Module::t('registration', 'If you did not make this request you can ignore this email');
?>
.
</p>
Beispiel #8
0
<?php

use im\users\Module;
use yii\helpers\Html;
/* @var $this yii\web\View */
$this->title = Module::t('registration', 'Sign up');
$this->params['breadcrumbs'][] = $this->title;
?>

<div class="registration-success">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
if (Yii::$app->getSession()->has('registration.success')) {
    ?>
        <div class="alert alert-success"><?php 
    echo Yii::$app->getSession()->getFlash('registration.success', null, true);
    ?>
</div>
    <?php 
}
?>

    <?php 
if (Yii::$app->getSession()->has('registration.info')) {
    ?>
        <div class="alert alert-info"><?php 
Beispiel #9
0
</p>
                <?php 
    if ($module->registrationConfirmation) {
        ?>
                    <p><?php 
        echo Html::a(Module::t('login', 'Didn\'t receive confirmation message?'), ['/users/registration/resend']);
        ?>
</p>
                <?php 
    }
    ?>
                <?php 
    if ($module->enableRegistration) {
        ?>
                    <p><?php 
        echo Html::a(Module::t('login', 'Don\'t have an account? Sign up!'), ['/users/registration/register']);
        ?>
</p>
                <?php 
    }
    ?>

            </div>
        </div>

        <?php 
    ActiveForm::end();
    ?>

        <?php 
    if (Yii::$app->get('authClientCollection', false)) {
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['username' => Module::t('registration', 'Username'), 'email' => Module::t('registration', 'E-mail'), 'password' => Module::t('registration', 'Password'), 'password2' => Module::t('registration', 'Repeated password'), 'firstName' => Module::t('registration', 'First name'), 'lastName' => Module::t('registration', 'Last name')];
 }
Beispiel #11
0
        ?>

            <p><?php 
        echo Html::a(Module::t('registration', 'Login here'), ['/users/login']);
        ?>
</p>

        <?php 
    }
    ?>

    <?php 
} elseif (Yii::$app->getSession()->has('confirmation.error')) {
    ?>

        <div class="alert alert-danger"><?php 
    echo Yii::$app->getSession()->getFlash('confirmation.error');
    ?>
</div>

        <p><?php 
    echo Html::a(Module::t('registration', 'Resend confirmation link'), ['/users/registration/resend']);
    ?>
</p>

    <?php 
}
?>

</div>
Beispiel #12
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['first_name' => Module::t('user', 'First name'), 'last_name' => Module::t('user', 'Last name'), 'avatar_url' => Module::t('user', 'Avatar URL')];
 }
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['password' => Module::t('recovery', 'Password'), 'password2' => Module::t('recovery', 'Repeated password')];
 }
Beispiel #14
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => Module::t('token', 'ID'), 'user_id' => Module::t('token', 'User ID'), 'token' => Module::t('token', 'Token'), 'type' => Module::t('token', 'Type'), 'created_at' => Module::t('user', 'Created at')];
 }
Beispiel #15
0
                <?php 
    echo $form->field($model, 'firstName');
    ?>

                <?php 
    echo $form->field($model, 'lastName');
    ?>

                <div class="form-group">
                    <?php 
    echo Html::submitButton(Module::t('registration', 'Sign up'), ['class' => 'btn btn-primary', 'name' => 'register-button']);
    ?>
                </div>

                <?php 
    ActiveForm::end();
    ?>
            </div>
        </div>

        <?php 
    echo Html::a(Module::t('registration', 'Already registered? Sign in!'), ['/user/security/login']);
    ?>

    <?php 
}
?>

</div>
<?php

use im\users\Module;
use yii\helpers\Url;
/* @var yii\web\View $this */
/* @var im\users\models\User $user */
/* @var im\users\models\Token $token */
?>

<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
    <?php 
echo Module::t('recovery', 'Hello');
?>
 <?php 
echo $user->profile->first_name;
?>
,
</p>
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
    <?php 
echo Module::t('recovery', 'Please click the link below to reset your password');
?>
.
</p>
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
    <?php 
echo Url::to(['/users/recovery/reset', 'token' => $token->token], true);
?>
</p>
Beispiel #17
0
        <?php 
    }
    ?>

        <div class="row">
            <div class="col-md-6">
                <?php 
    $form = ActiveForm::begin();
    ?>

                <?php 
    echo $form->field($model, 'email')->textInput(['autofocus' => true]);
    ?>

                <div class="form-group">
                    <?php 
    echo Html::submitButton(Module::t('registration', 'Submit'), ['class' => 'btn btn-primary', 'name' => 'recovery-button']);
    ?>
                </div>

                <?php 
    ActiveForm::end();
    ?>
            </div>
        </div>

    <?php 
}
?>

</div>
 /**
  * Displays page where user can request new confirmation token.
  *
  * @return string
  * @throws \yii\web\HttpException
  */
 public function actionResend()
 {
     if (!$this->module->registrationConfirmation) {
         throw new NotFoundHttpException();
     }
     $userComponent = $this->getUserComponent();
     $model = $this->getResendForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($userComponent->sendConfirmationToken($model->getUser())) {
             Yii::$app->session->setFlash('resend.success', Module::t('registration', 'A message has been sent to your e-mail address. It contains a confirmation link that you have to click to complete registration.'));
             return $this->refresh();
         }
     }
     return $this->render('resend', ['model' => $model]);
 }