Welcome Guest, Not a member yet? Register   Sign In
The Authentication Library 1.0.6
#81

[eluser]joytopia[/eluser]
Bug in sha1-syntax?

in Auth.php we have the function:

Code:
/**
    * Salt the users password
    *
    * @access private
    * @param string
    */
    function _salt($str)
    {
        return sha1($this->CI->config->item('encryption_key').$str);
    } // function _salt()

When I read it correctly, it means:
If the encryption_key is "abcdefg" and the Password is "12345", it will

Code:
return sha1(abcdefg12345);

Is this a bug or a feature?
Or did I make a mistake?

Best regards
Bernd
#82

[eluser]Nicholai[/eluser]
I read the guide, watched the screencast and perused the forum, but was unable to find some simple examples of usage that use the core auth functions without the dashboard. Here is a code sample that seems to work for me so far; I'm not very advanced but hopefully it will help someone else get off the ground with this great library as well!

Controller:
Code:
class Login extends Application {

    function Login()
    {
        parent::Application();
    }
    
    function index()
    {
        $username = $this->input->post('username');

        if (!logged_in())
        {        
            if (isset($username) && $username != '')
            {
                 $this->auth->login('tasks');            
            }
            else
            {
                $data['page_title'] = 'Please log in';
                $this->load->view('login', $data);
            }
        }
        
        else
        {
            redirect('tasks');
        }
    }

}
View:
Code:
<?php echo form_open('login');?>

        <p>
            <label for="username"><span>Username:</span></label>
            &lt;input type="text" name="username" id="username" maxlength="50" class="loginitem" size="40" /&gt;
            <span id="userError" class="error"></span>
        </p>

        <p>
            <label for="password"><span>Password</span></label>
            &lt;input type="password" name="password" id="password" maxlength="100" class="loginitem" size="40" /&gt;
            <span id="passError" class="error"></span>
        </p>

        <p>
            &lt;?php echo form_submit('login', 'Log In', 'id="login" class="submitbutton"');?&gt;
        </p>

    &lt;?php echo form_close();?&gt;
#83

[eluser]squarebones[/eluser]
Adam,

I've had your library installed and working for a while, but I want to extend it's functionality and I can't for the life of me figure out how the $_POST array is being accessed by the Auth library. Where in the code does it ever read the POSTed values from the various forms? This would be a great technique to learn to avoid having to use the $this->input->post('thingy') call everytime I need to access some POSTed values.

Thank you for a great library!
#84

[eluser]sacramentojoe[/eluser]
It happens in Auth.php for login and register, at least I think it does.

Auth.php line 133 shows $username = set_value('username');

This set_value(' appears to be input box name ') was a pattern I saw.
#85

[eluser]sacramentojoe[/eluser]
Line 361 appears as such. $token =”; what you can't easily tell, is that is just one double quote, not two single quotes.''.
#86

[eluser]Bjørn Børresen[/eluser]
Can this lib be used together with HMVC? Tried dropping it into the modules folder but that didn't seem to work. Get this error:

Code:
[08-Feb-2010 21:05:00] PHP Fatal error:  Class 'Application' not found in C:\dev\xampp\htdocs\authtest\wwwdocs\system\application\modules\auth\controllers\admin\admin.php on line 3
#87

[eluser]useeme_p[/eluser]
Hi everyone,

New to ci_ and wanted to try this auth library. I have it installed properly but can seem to register the first user. The page just refreshes and does nothing. I checked the db and the session shows that I loaded the pages. Any input would be great..

thanks ,


Ps. This was resolved. user error ..
#88

[eluser]seanloving[/eluser]
[quote author="Bjørn Børresen" date="1265681769"]Can this lib be used together with HMVC? Tried dropping it into the modules folder but that didn't seem to work. Get this error:

Code:
[08-Feb-2010 21:05:00] PHP Fatal error:  Class 'Application' not found in C:\dev\xampp\htdocs\authtest\wwwdocs\system\application\modules\auth\controllers\admin\admin.php on line 3
[/quote]

I have it working with HMVC. Make sure to use application/libraries/MX_Controller.php...
Code:
class Application extends Controller
{

    var $controllers; // These all track root folders for views, models, controllers; specified in Auth config
    var $models;
    var $views;
    
    function Application()
    {
        parent::Controller();

SL
#89

[eluser]Dan Horrigan[/eluser]
[quote author="sacramentojoe" date="1264940871"]It happens in Auth.php for login and register, at least I think it does.

Auth.php line 133 shows $username = set_value('username');

This set_value(' appears to be input box name ') was a pattern I saw.[/quote]

The set_value function is a helper function from the form validation helper. See the user guide for more info: http://ellislab.com/codeigniter/user-gui...rreference

Hope that clears it up a little bit.
#90

[eluser]jordan314[/eluser]
Hi,
Thanks for coding this library. I just installed and am having problems though. I take it your code depends on being able to connect to random.org? Every function I try (register, dashboard, login, logout) waits about a minute and then times out with this error:
A PHP Error was encountered

Severity: Warning

Message: fopen(http://random.org/strings/?num=1&len=20&digits=on&upperalpha=on&loweralpha=on&unique=on&format=plain&rnd=new) [function.fopen]: failed to open stream: HTTP request failed!

Filename: libraries/Auth.php

Line Number: 348
A PHP Error was encountered

Severity: Warning

Message: fread(): supplied argument is not a valid stream resource

Filename: libraries/Auth.php

Line Number: 349

My users are not being stored correctly in the database either. Any suggestions?
Thanks,
Jordan




Theme © iAndrew 2016 - Forum software by © MyBB