Welcome Guest, Not a member yet? Register   Sign In
crsf and ion_auth reset password
#3

(02-07-2018, 02:02 PM)ChicagoPhil Wrote: Are you using the forms that came in ion auth? I'm still thinking of what is going wrong here but are you sure the problem stems from the controller?

I did not foresee it as an issue but it turns out using forms improved from those provided with the ion_auth package are somehow responsible for the flashdata being deleted from the $_SESSION.

So the question becomes what do I do to make the flashdata persist or what to look for in my forms that is causing the session to regenerate?

I can't identify something in the form to cause the session to regenerate.  All I changed was some of the semantic mark up of html, head and body tags so css or javascript can be incorporated.  The forms in ion_auth are only the form.  No other mark up. I did not change any of the semantics inside the form_open and form_close syntax.

I tried the following syntax to make the session persist. It was inserted at the point form validation is FALSE and the form for submitting a new password is generated (second to last line):

PHP Code:
if ($this->form_validation->run() === FALSE)
{
    
// display the form

    // set the flash data error message if there is one
    
$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');

    
$this->data['min_password_length'] = $this->config->item('min_password_length''ion_auth');
    
$this->data['new_password'] = array(
        
'name' => 'new',
        
'id' => 'new',
        
'type' => 'password',
        
'pattern' => '^.{' $this->data['min_password_length'] . '}.*$',
    );
    
$this->data['new_password_confirm'] = array(
        
'name' => 'new_confirm',
        
'id' => 'new_confirm',
        
'type' => 'password',
        
'pattern' => '^.{' $this->data['min_password_length'] . '}.*$',
    );
    
$this->data['user_id'] = array(
        
'name' => 'user_id',
        
'id' => 'user_id',
        
'type' => 'hidden',
        
'value' => $user->id,
    );
    
$this->data['csrf'] = $this->_get_csrf_nonce();
    
$this->data['code'] = $code;

    
$this->data['site_title'] = 'Reset Password — '.$this->config->item('site_title');
    
    
//added to keep flashdata persistent
    
$this->session->keep_flashdata(array('csrfkey','csrfvalue'));

    
// render
    
$this->_render_page('reset_password_form'$this->data); 
Reply


Messages In This Thread
crsf and ion_auth reset password - by dwlamb - 02-07-2018, 01:29 PM
RE: crsf and ion_auth reset password - by dwlamb - 02-07-2018, 10:43 PM
RE: crsf and ion_auth reset password - by dwlamb - 02-08-2018, 08:10 AM
RE: crsf and ion_auth reset password - by dwlamb - 02-08-2018, 10:27 AM
RE: crsf and ion_auth reset password - by dwlamb - 02-12-2018, 04:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB