TRUE,
'resetpassword'=>TRUE,
);
/**
* Enable User to Edit their Account Details
*/
public function action_edit() {
// Store our new values
$this->ao->values($_POST);
// Run validation and save
if ($this->ao->changed())
if ($this->ao->check()) {
SystemMessage::factory()
->title('Record updated')
->type('success')
->body(_('Your account record has been updated.'));
$this->ao->save();
} else {
$output = '';
// @todo Need to check that this still works with the new bootstrap theming
foreach ($this->ao->validation()->errors('forms/login') as $field => $error)
$output .= sprintf('
%s %s',$field,$error);
if ($output)
$output = sprintf('',$output);
SystemMessage::factory()
->title(_('Record NOT updated'))
->type('error')
->body(_('Your updates didnt pass validation.').'
'.$output);
}
Block::factory()
->title(sprintf('Account: %s',$this->ao->accnum()))
->title_icon('icon-wrench')
->type('form-horizontal')
->body(View::factory('account/user/edit')->set('o',$this->ao));
}
public function action_resetpassword() {
// @todo Fix this next logic, since matches_ifset is not being called when the value is on the form, but empty
if (empty($_POST['password_confirm']))
$_POST['password_confirm'] = ' ';
// Store our new values
$this->ao->values($_POST);
// Run validation and save
if ($this->ao->changed())
if ($this->ao->check()) {
SystemMessage::factory()
->title('Record updated')
->type('success')
->body(_('Your account record has been updated.'));
$this->ao->save();
// Log the password reset
$this->ao->log('Password reset');
HTTP::redirect('login');
} else {
// @todo Need to check that this still works with the new bootstrap theming
$output = '';
foreach ($this->ao->validation()->errors('forms/login') as $field => $error)
$output .= sprintf('%s %s',$field,$error);
if ($output)
$output = sprintf('',$output);
SystemMessage::factory()
->title(_('Record NOT updated'))
->type('error')
->body(_('Your updates didnt pass validation.').'
'.$output);
}
// @todo To add JS password validation (minimum length and both values equal)
Block::factory()
->title(sprintf('Password Reset: %s',$this->ao->accnum()))
->title_icon('icon-cog')
->type('form-horizontal')
->body(View::factory('account/user/resetpassword')->set('o',$this->ao));
}
}
?>