14 'class' =>
'CCaptchaAction',
15 'backColor' => 0xFFFFFF,
26 $profile->regMode =
true;
29 if (isset($_POST[
'ajax']) && $_POST[
'ajax'] ===
'registration-form') {
30 echo UActiveForm::validate(array($model, $profile));
35 $this->redirect(Yii::app()->controller->module->profileUrl);
37 if (isset($_POST[
'RegistrationForm'])) {
38 $model->attributes = $_POST[
'RegistrationForm'];
39 $profile->attributes = ((isset($_POST[
'Profile']) ? $_POST[
'Profile'] : array()));
41 if ($model->validate() && $profile->validate()) {
42 $soucePassword = $model->password;
46 $model->superuser = 0;
50 $profile->user_id = $model->id;
54 $model->setDefaultUserAssignments($model->id);
56 if (Yii::app()->controller->module->sendActivationMail) {
57 $activation_url = $this->createAbsoluteUrl(
'/user/activation/activation', array(
"activkey" => $model->activkey,
"email" => $model->email));
58 UserModule::sendMail($model->email,
UserModule::t(
"You registered from {site_name}", array(
'{site_name}' => Yii::app()->name)),
UserModule::t(
"Please activate you account go to {activation_url}", array(
'{activation_url}' => $activation_url)));
61 if ((Yii::app()->controller->module->loginNotActiv || (Yii::app()->controller->module->activeAfterRegister && Yii::app()->controller->module->sendActivationMail ==
false)) && Yii::app()->controller->module->autoLogin) {
62 $identity =
new UserIdentity($model->username, $soucePassword);
63 $identity->authenticate();
64 Yii::app()->user->login($identity, 0);
65 $this->redirect(Yii::app()->controller->module->returnUrl);
67 if (!Yii::app()->controller->module->activeAfterRegister && !Yii::app()->controller->module->sendActivationMail) {
68 Yii::app()->user->setFlash(
'registration',
UserModule::t(
"Thank you for your registration. Contact Admin to activate your account."));
69 } elseif (Yii::app()->controller->module->activeAfterRegister && Yii::app()->controller->module->sendActivationMail ==
false) {
70 Yii::app()->user->setFlash(
'registration',
UserModule::t(
"Thank you for your registration. Please {{login}}.", array(
'{{login}}' => CHtml::link(
UserModule::t(
'Login'), Yii::app()->controller->module->loginUrl))));
71 } elseif (Yii::app()->controller->module->loginNotActiv) {
72 Yii::app()->user->setFlash(
'registration',
UserModule::t(
"Thank you for your registration. Please check your email or login."));
74 Yii::app()->user->setFlash(
'registration',
UserModule::t(
"Thank you for your registration. Please check your email."));
83 $this->render(
'/user/registration', array(
'model' => $model,
'profile' => $profile));