修复没有为新注册的用户创建Home的bug

This commit is contained in:
Chenx221 2024-03-04 15:51:45 +08:00
parent a70d7ad63a
commit 6b568955a6
Signed by: chenx221
GPG Key ID: D7A9EC07024C3021

View File

@ -305,6 +305,11 @@ class UserController extends Controller
$model->role = 'user';
$model->name = $model->username; //用户默认昵称为用户名,后期可以修改
if ($model->save(false)) { // save without validation
$userFolder = Yii::getAlias(Yii::$app->params['dataDirectory']) . '/' . $model->id;
if (!is_dir($userFolder)) {
mkdir($userFolder);
}
Yii::$app->session->setFlash('success', 'Registration successful. You can now log in.');
return $this->redirect(['login']);
} else {
@ -379,4 +384,6 @@ class UserController extends Controller
}
return $this->redirect(['user/info', 'focus' => 'password']);
}
}