Welcome Guest, Not a member yet? Register   Sign In
Callback "Password Check" Problem...
#7

[eluser]Ortonruk[/eluser]
No problem, I have attached it below. On a side note I think I have fixed the problem of it accepting any password when it finds an email address in the db. So now the only problem is with these salted hashes not matching up.

Code:
function Front()
{
    parent::Controller();
    $this->load->library(array('form_validation', 'session'));
    $this->load->helper(array('url', 'form'));
    $this->load->model('front_model');
            
    $this->_salt = "191714558397772541";
}

function signup()
{
    $this->form_validation->set_rules('email', 'Email Address', 'xss_clean|required|valid_email|matches[email_conf]|callback_email_exists');
    $this->form_validation->set_rules('email_conf', 'Confirm Email Address', 'xss_clean|required|valid_email|matches[email]');
    $this->form_validation->set_rules('password', 'Password', 'xss_clean|required|min_length[6]|max_length[12]|matches[password_conf]|alpha_numeric|sha1');
    $this->form_validation->set_rules('password_conf', 'Confirm Password', 'xss_clean|required|matches[password]|alpha_numeric|sha1');
    $this->form_validation->set_rules('firstname', 'First Name', 'xss_clean|required|alpha');
    $this->form_validation->set_rules('lastname', 'Last Name', 'xss_clean|required|alpha');
    $this->form_validation->set_rules('age', 'Age', 'xss_clean|required|numeric|max_length[3]');
    $this->form_validation->set_rules('gender', 'Gender', 'xss_clean|required|alpha');
    $this->form_validation->set_rules('country', 'Country', 'xss_clean|required');
            
    if($this->form_validation->run() == FALSE)
    {
        $this->load->view('account_view');
    }
    else
    {
        $data['email'] = $this->input->post('email');
        $data['password'] = sha1($this->_salt . $this->input->post('password'));
        $data['firstname'] = $this->input->post('firstname');
        $data['lastname'] = $this->input->post('lastname');
        $data['age'] = $this->input->post('age');
        $data['gender'] = $this->input->post('gender');
        $data['country'] = $this->input->post('country');
                
        if($this->front_model->create($data) === TRUE)
        {
            $data['message'] = "Your account has been successfully created! You can now continue by logging in.";
            $this->load->view('signup_success', $data);
        }
        else
        {
            $data['error'] = "There was a problem creating your account. Please try again.";
            $this->load->view('signup_error', $data);
        }
    }
}


Messages In This Thread
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 08:28 AM
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 09:18 AM
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 09:22 AM
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 10:14 AM
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 10:19 AM
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 10:31 AM
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 10:39 AM
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 11:06 AM
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 11:17 AM
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 11:34 AM
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 11:40 AM
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 11:45 AM
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 12:22 PM
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 12:36 PM
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 01:22 PM
Callback "Password Check" Problem... - by El Forum - 02-15-2011, 02:59 PM
Callback "Password Check" Problem... - by El Forum - 04-16-2011, 02:26 PM
Callback "Password Check" Problem... - by El Forum - 04-16-2011, 03:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB