Welcome Guest, Not a member yet? Register   Sign In
form helper and sha1
#1

[eluser]bobbob[/eluser]
This is a newbie question no doubt.
When the form validation fails it sends back the inputs of the user.
I don't want to send the sha1 version of the password as if they hit submit again it will sha1 that. Very secure maybe but I doubt very memorable :-)
How to get around this and sha1 after validation?

This is in my register controller.
Db is auto loaded.

Code:
function index()
    {
        $this->load->helper(array('form', 'url'));
        
        $this->load->library('form_validation');
        
        $this->form_validation->set_rules('user_name', 'Username', 'trim|required|min_length[3]|max_length[30]|xss_clean|callback_username_check');
        $this->form_validation->set_rules('password', 'Password', 'trim|required|sha1');
        
        $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|callback_email_check');
                
        if ($this->form_validation->run() == FALSE)
        {
            $this->load->view('registration');
        }
        else
        {
            
            $this->db->insert('members', $_POST);
            $this->load->view('reg_success');
        }
    }
Thanks
#2

[eluser]Ebot Ndip-Agbor[/eluser]
that should be done in the view file called 'registration'. Each time the registration page is loaded, check if the variable username exists. If it does, make it the value of the "username" form field.
#3

[eluser]bobbob[/eluser]
I think you made me realise just removing this:
<?php echo set_value('password'); ?>

from this:
<input type="text" name="password" value="<?php echo set_value('password'); ?>" size="50" />
will solve my problem.
on the registration page.
Tx




Theme © iAndrew 2016 - Forum software by © MyBB