This repository has been archived on 2024-12-01. You can view files and clone it, but cannot push or open issues or pull requests.
factuges_web/www/protected/modules/yii-user-master/controllers/ActivationController.php

31 lines
1.1 KiB
PHP
Raw Normal View History

<?php
class ActivationController extends Controller
{
public $defaultAction = 'activation';
/**
* Activation user account
*/
public function actionActivation () {
$email = $_GET['email'];
$activkey = $_GET['activkey'];
if ($email&&$activkey) {
$find = User::model()->notsafe()->findByAttributes(array('email'=>$email));
if (isset($find)&&$find->status) {
$this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("You account is active.")));
} elseif(isset($find->activkey) && ($find->activkey==$activkey)) {
$find->activkey = UserModule::encrypting(microtime());
$find->status = 1;
$find->save();
$this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("You account is activated.")));
} else {
$this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("Incorrect activation URL.")));
}
} else {
$this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("Incorrect activation URL.")));
}
}
}