Welcome Guest, Not a member yet? Register   Sign In
BackendPro 0.6.1

[eluser]a&w[/eluser]
The welcome page should be different than the default CodeIgniter welcome page. It will show if you are logged in, etc.

You should be able to go to yoursite/index.php/welcome/
to see that page. Go to yoursite/system/application/controllers/welcome.php and rename that file to welcome_CI.php. If you do that you should see the BePro welcome page.

[eluser]adamp1[/eluser]
@kakap: Great to know your looking forward to BeP. I understand at the moment the place where things go is a bit confusing. Its on my list to allow the user to change this during the install.

Right lets try to sort these issues out:
1. I try to run “localhost/~kakap/code/install/install.php” but its blank.
You are running the wrong file. You need to visit “localhost/~kakap/code/install”

2.How can I allow the user to login with user name or email
The way a&w described is 100% correct. Again this is another feature I want to add.

3.How to enter the admin page
After you have installed, you should be shown a page saying login. Upon logging in using the details you specified during install you will be taken to the admin area (since you will be logging in with the main administrator account)

[eluser]kakap[/eluser]
ok,thanks everyone
it's done Smile

[eluser]Tom Glover[/eluser]
Quick question: Does BEPro work with CI 1.7?

[eluser]adamp1[/eluser]
The version from the SVN I believe does work with CI1.7 but I am not 100%. BeP will be CI 1.7 compatible from 0.4 onwards which I am trying to release atm.

So either get the version from SVN or wait till 0.4 but that could be anything from a week to a month away depending on how much I can get done on it.

[eluser]Tom Glover[/eluser]
[quote author="adamp1" date="1228072801"]The version from the SVN I believe does work with CI1.7 but I am not 100%. BeP will be CI 1.7 compatible from 0.4 onwards which I am trying to release atm.

So either get the version from SVN or wait till 0.4 but that could be anything from a week to a month away depending on how much I can get done on it.[/quote]

Thanks for the Reply.

[eluser]JimmyPHP[/eluser]
[quote author="adamp1" date="1227885206"]It shouldn't be too hard. What I would say is instead of changing all the code, add some code so you can swap between using email or username for login, I know this is a possible feature I want to add in the future.[/quote]

I looked into the code and modified it to work with usernames instead of emails on the login form. Agreed, it would be nice if you could add a config switch in the install to toggle between the two. Here are the significant changes I made:

In the file \modules\auth\libraries\Auth_form_processing.php

Code:
function login_form($container)
        {
            // First lets see if they are logged in, if so run action for that user
            if ( is_user() ) {
                // If they have access to the control panel panel send them there
                if( check('Control Panel',NULL,FALSE)) {
                    redirect($this->CI->config->item('userlib_action_admin_login'),'location');
                }
                // Otherwise run user action
                redirect($this->CI->config->item('userlib_action_login'),'location');
            }

            // Setup fields
            $fields['username'] = $this->CI->lang->line('userlib_username');
            //$fields['email'] = $this->CI->lang->line('userlib_email');
            $fields['password'] = $this->CI->lang->line('userlib_password');
            $fields['recaptcha_response_field'] = $this->CI->lang->line('userlib_captcha');
            $this->CI->validation->set_fields($fields);

            // Set Rules
            // Only run captcha check if needed
            $rules['username'] = 'trim|required';
            //$rules['email'] = 'trim|required|valid_email';
            $rules['password'] = 'trim|required';
            if($this->CI->preference->item('use_login_captcha')){
$rules['recaptcha_response_field'] = 'trim|required|valid_captcha';}
            $this->CI->validation->set_rules($rules);

<snip>



        function _login()
        {
            // Fetch what they entered in the login
            $values['username'] = $this->CI->input->post('username');
            //$values['email'] = $this->CI->input->post('email');
            $values['password'] = $this->CI->userlib->encode_password($this->CI->input->post('password'));

            // See if a user exists with the given credentials
            $query = $this->CI->user_model->validateLogin($values['username'],$values['password']);
            //$query = $this->CI->user_model->validateLogin($values['email'],$values['password']);

<snip>

And in the file \modules\auth\models\user_model.php
Code:
//function validateLogin($email, $password)
        //{
        //    return $this->fetch('Users','id,active',null,array('email'=>$email,'password'=>$password));
        //}
        function validateLogin($username, $password)
        {
            return $this->fetch('Users','id,active',null,array('username'=>$username,'password'=>$password));
        }

As well as the login form code \modules\auth\views\public\form_login.php. I'll omit these for the sake of brevity.

*At the time of writing this I noticed that the email addy is stored in the session cookie for auto login, so this may need to be changed as well.

So I guess to do this properly, we should set a config item value in \modules\auth\config\userlib.php to toggle between email or username as the base for authentication and then check that config value in (at least) the areas identified above. Shouldn't be a big deal.

@adamp1: Did you want me to send you some diffs with this, or can you take it from here?

[eluser]a&w[/eluser]
JimmyPHP:

IMHO the better way to go is to add it to the admin panel, that way you can change it at any point:
http://ellislab.com/forums/viewreply/496575/

Just change the form itself to have an abstract "login" field which then accepts username, email, whatever field you choose to accept, it could be anything really (you'd basically just have a switch statement to pick up the rules corresponding to whatever is specified).

[eluser]JimmyPHP[/eluser]
I saw your post after my post and agree with you. Perhaps you could share your changes with us.

[eluser]adamp1[/eluser]
Cheers for the work there Jimmy, I can look at your example code here thanks. I think when I do implement this it will be as a&w says with an admin option.

Hopefully as soon as this clients website im finishing is done I can get back to finishing BeP0.4, hopefully it can be a xmas present for all the CI community.




Theme © iAndrew 2016 - Forum software by © MyBB