|
|
@@ -111,6 +111,9 @@ class UserController extends BackendController |
|
|
|
$model->setPassword($password); |
|
|
|
$model->generateAuthKey(); |
|
|
|
$model->username = $model->email ; |
|
|
|
if(!strlen($model->email)) |
|
|
|
$model->username = 'inconnu@laboiteapain.net' ; |
|
|
|
|
|
|
|
$model->save() ; |
|
|
|
|
|
|
|
// liaison etablissement / user |
|
|
@@ -122,16 +125,19 @@ class UserController extends BackendController |
|
|
|
$user_etablissement->save() ; |
|
|
|
|
|
|
|
// send mail |
|
|
|
$etablissement = Etablissement::findOne(Yii::$app->user->identity->id_etablissement) ; |
|
|
|
Yii::$app->mailer->compose() ; |
|
|
|
$mail = Yii::$app->mailer->compose( |
|
|
|
['html' => 'createUserAdmin-html', 'text' => 'createUserAdmin-text'], |
|
|
|
['user' => $model, 'etablissement' => $etablissement, 'password' => $password]) |
|
|
|
->setTo($model->email) |
|
|
|
->setFrom(['contact@laboiteapain.net' => 'La boîte à pain']) |
|
|
|
->setSubject('[La boîte à pain] Inscription') |
|
|
|
->send() ; |
|
|
|
|
|
|
|
if(strlen($model->email)) |
|
|
|
{ |
|
|
|
$etablissement = Etablissement::findOne(Yii::$app->user->identity->id_etablissement) ; |
|
|
|
Yii::$app->mailer->compose() ; |
|
|
|
$mail = Yii::$app->mailer->compose( |
|
|
|
['html' => 'createUserAdmin-html', 'text' => 'createUserAdmin-text'], |
|
|
|
['user' => $model, 'etablissement' => $etablissement, 'password' => $password]) |
|
|
|
->setTo($model->email) |
|
|
|
->setFrom(['contact@laboiteapain.net' => 'La boîte à pain']) |
|
|
|
->setSubject('[La boîte à pain] Inscription') |
|
|
|
->send() ; |
|
|
|
} |
|
|
|
|
|
|
|
return $this->redirect(['index']); |
|
|
|
} else { |
|
|
|
return $this->render('create', [ |