Welcome Guest, Not a member yet? Register   Sign In
Redux Auth Question?
#1

[eluser]Solarpitch[/eluser]
Hey guys,

this is more of a problem than a question but here it goes... I've installed Redux and modified the config files and that. I am able to register a user to the database.

The problem occurs when I try to check if the username exists or if I try to determine if the user is logged in using logged_in()

Here's what I have...

Code:
class User extends Controller
{

    function User()
    {
        parent::Controller();
        $this->load->helper('url');
        $this->load->model('product_model');
        $this->load->helper('form');
        
    }

    function register ()
    {
        // Required Field Rules.
        $rules['username']    = "required";
        $rules['password']    = "required";
        $rules['password2']     = "required";
        $rules['email']         = "required";
        $rules['question']     = "required";
        $rules['answer']         = "required";

//When I call this function and submit the form, the page just reloads and the form
disappears. It wont print a message telling me that the username already exists.

$rules['username'] = "callback_check_username";
        
        $this->validation->set_rules($rules);
        
        // Required Field Names
        $fields['username']     = "Username";
        $fields['password']     = "Password";
        $fields['password2']     = "Repeat Password";
        $fields['email']         = "Email Address";
        $fields['question']        = "Secret Question";
        $fields['answer']        = "Secret Answer";
        
        $this->validation->set_fields($fields);
            
        if ($this->validation->run())
        {
            // Validation Passed
            
            $redux = $this->redux_auth->register
            (
                $this->input->post('username'),
                $this->input->post('password'),
                $this->input->post('email'),
                $this->input->post('question'),
                $this->input->post('answer')
            );
            
            // The reason we put the method into a variable is so we can deal
            // with the different return messages.
            
            // I use a switch statement to deal with the different return
            // messages produced by the registration method.
            
            switch ($redux) {
                case 'REGISTRATION_SUCCESS':
                    # code...
                    break;
                case 'REGISTRATION_SUCCESS_EMAIL':
                    # code...
                    break;
                case false:
                    # code...
                    break;
                case true:
                    # code...
                    
                    break;
            }
        }
        else
        {
            $this->load->view("users/register");
        }
    }

}
#2

[eluser]Popcorn[/eluser]
Hi, I can see you are using the old 1.4 version. The new beta has all the features of the current build and adds a bit more. It also has a working sample application which may give you a better understanding of how it all works.

It also removes the need for the silly switch statement.

To answer your question, where is your callback function?
#3

[eluser]Unknown[/eluser]
[quote author="Popcorn" date="1232661596"]Hi, I can see you are using the old 1.4 version. The new beta has all the features of the current build and adds a bit more. It also has a working sample application which may give you a better understanding of how it all works.

It also removes the need for the silly switch statement.

To answer your question, where is your callback function?[/quote]
Hi Popcorn. I have one problem with the email validation function of Redux. I've set all the stuff in the application/config/email.php and there is no error throwing but the mail doesn't arrive in my mailbox. Also it's good to know that i'm a pretty newbie to codeigniter. But if you can help me with a way to debug this it will be pretty cool. Thanks

Edited // I'm using the Redux Auth 2 Beta




Theme © iAndrew 2016 - Forum software by © MyBB