/** * @method POST * @customRoute('user/register') * @param RegisterBindingModel $model * @throws \Exception */ public function register(RegisterBindingModel $model) { $username = $model->username; $password = $model->password; $confirm = $model->confirm; $name = isset($model->name) ? $model->name : null; if ($password != $confirm) { throw new \Exception('Password and confirmation do not match'); } $userModel = new UserRepository($this->_databaseInstance); $userModel->register($username, $password); $this->initLogin($username, $password); }
/** * @method POST * @route('user/register') * @param RegisterBindingModel $model * @throws \Exception */ public function register(RegisterBindingModel $model) { $username = $model->getUsername(); $password = $model->getPassword(); $confirm = $model->getConfirm(); $name = $model->getName(); if ($password != $confirm) { throw new \Exception('Password and confirmation do not match'); } $userModel = new UserRepository($this->databaseInstance); $userModel->register($username, $password); $this->initLogin($username, $password); }