registration fix

This commit is contained in:
2024-02-05 23:58:48 +03:00
parent 5cfd591140
commit eb1abd41e5
13 changed files with 83 additions and 10 deletions

View File

@ -2,6 +2,7 @@
namespace frontend\models;
use common\classes\Debug;
use common\models\Status;
use Yii;
use yii\base\Model;
use common\models\User;
@ -14,6 +15,7 @@ class SignupForm extends Model
public $username;
public $email;
public $password;
public $is_partner = 0;
/**
@ -35,6 +37,8 @@ class SignupForm extends Model
['password', 'required'],
['password', 'string', 'min' => 6],
['is_partner', 'integer']
];
}
@ -60,6 +64,8 @@ class SignupForm extends Model
$authorRole = $auth->getRole('user');
$auth->assign($authorRole, $user->id);
User::createSimpleProfile($user->email, $this->is_partner ? Status::getByName("Партнер") : Status::getByName("Аутстафинг"));
return $user->save() ? $user : null;
}
}