本文整理汇总了PHP中UserModule::generate_password方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModule::generate_password方法的具体用法?PHP UserModule::generate_password怎么用?PHP UserModule::generate_password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModule
的用法示例。
在下文中一共展示了UserModule::generate_password方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
/**
* Registration user
*/
public static function register($model, $post, $role = 'Customer')
{
$model->attributes = $post;
if (isset($_COOKIE['partner'])) {
$model->pid = intval($_COOKIE['partner']);
}
if ($model->validate()) {
$soucePassword = UserModule::generate_password(8);
$model->password = UserModule::encrypting($soucePassword);
$model->superuser = 0;
$model->status = 1;
if ($model->save()) {
$AuthAssignment = new AuthAssignment();
$AuthAssignment->attributes = array('itemname' => $role, 'userid' => $model->id);
$AuthAssignment->save();
if ($role == 'Author') {
if ($model->profile == null) {
$profile = new Profile();
$profile->user_id = $model->id;
$profile->mailing_for_executors = 1;
$profile->save();
}
}
$webmasterlog = new WebmasterLog();
$webmasterlog->pid = $model->pid;
$webmasterlog->uid = $model->id;
$webmasterlog->date = date("Y-m-d");
$webmasterlog->action = WebmasterLog::REG;
$webmasterlog->save();
// новая служба системных сообщений
$type_id = Emails::TYPE_11;
$email = new Emails();
$criteria = new CDbCriteria();
$criteria->order = 'id DESC';
$criteria->limit = 1;
$user = User::model()->findAll($criteria);
$user = $user[0];
$email->from_id = 1;
$email->to_id = $user->id;
$rec = Templates::model()->findAll("`type_id`='{$type_id}'");
$id = Company::getId();
$email->company = Company::getName();
$email->name = $model->full_name;
$email->login = $model->email;
$email->password = $soucePassword;
$email->page_cabinet = 'http://' . $_SERVER['SERVER_NAME'] . '/user/profile/edit';
$email->sendTo($user->email, $rec[0]->title, $rec[0]->text, $type_id);
$identity = new UserIdentity($model->email, $soucePassword);
$identity->authenticate();
Yii::app()->user->login($identity, 0);
//$this->redirect(Yii::app()->controller->module->returnUrl[0]);
return true;
//Yii::app()->end();
} else {
//Yii::app()->user->setFlash('reg_failed',UserModule::t("Sorry, something wrong... :("));
//$this->refresh();
echo 'Cant save';
Yii::app()->end();
}
} else {
return false;
}
}