Skip to content

Commit

Permalink
Fix registration
Browse files Browse the repository at this point in the history
  • Loading branch information
xemlock committed Mar 10, 2019
1 parent 64bb41f commit 1e1e666
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
23 changes: 19 additions & 4 deletions controllers/RegistrationController/CreateAction.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
<?php

class ModUser_RegistrationController_CreateAction
extends Maniple_Controller_Action_StandaloneForm
/**
* @property Zend_Controller_Request_Http $_request
* @method Zend_Session_Namespace getSessionNamespace()
*/
class ModUser_RegistrationController_CreateAction extends Maniple_Controller_Action_StandaloneForm
{
/**
* @Inject('user.model.userMapper')
* @var ModUser_Model_UserMapperInterface
*/
protected $_userRepository;

/**
* @Inject('Zefram_Db')
* @var Zefram_Db
*/
protected $_db;

protected function _prepare()
{
if ($this->getSecurityContext()->isAuthenticated()) {
Expand All @@ -27,7 +42,7 @@ protected function _prepare()
if (!$formClass) {
$formClass = ModUser_Form_Registration::className;
}
$this->_form = new $formClass($this->getUserManager(), array('view' => $this->view));
$this->_form = new $formClass($this->_userRepository, array('view' => $this->view));

$this->view->form_template = 'mod-user/forms/registration';
}
Expand All @@ -47,7 +62,7 @@ protected function _process()
// hash password
$data['password'] = password_hash($data['password'], PASSWORD_BCRYPT);

$reg = $this->getTableManager()->getTable('ModUser_Model_DbTable_Registrations')->createRow(array(
$reg = $this->_db->getTable(ModUser_Model_DbTable_Registrations::className)->createRow(array(
'reg_id' => Zefram_Math_Rand::getString(64, Zefram_Math_Rand::BASE64URL),
'created_at' => time(),
'expires_at' => null, // TODO registration.lifetime setting
Expand Down
2 changes: 1 addition & 1 deletion library/ModUser/Form/Registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class ModUser_Form_Registration extends Zefram_Form
{
const className = __CLASS__;

public function __construct(ModUser_Model_UserManagerInterface $userManager, array $options = array())
public function __construct(ModUser_Model_UserMapperInterface $userManager, array $options = array())
{
$elements = array(
'first_name' => array(
Expand Down

0 comments on commit 1e1e666

Please sign in to comment.