CodeIgniter Forums
Ion Auth - Lightweight Auth System based on Redux Auth 2 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Ion Auth - Lightweight Auth System based on Redux Auth 2 (/showthread.php?tid=27435)



Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-04-2010

[eluser]Ben Edmunds[/eluser]
Frank,

What browser are you using?

Are you clearing cookies or anything?


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-04-2010

[eluser]hugle[/eluser]
Hello Ben and others,

I think it's not the Ion-Auth issue, but I did not know where else to ask it..

I've been playinig with SWF uploaders for few days, and came to one of the swf uploaders (baicaly from this post: http://ellislab.com/forums/viewthread/133388/)

the problem is, that I have an Admin controller, which check for logged in user..:
Code:
if (!$this->ion_auth->logged_in()) {
            redirect('auth/login', 'refresh');
        }

but the codeigniter does not recognize this SWF upload as the 'logged in user'...
and the uploader fails to upload. I have tried removing this code and upload starts working...

Maybe you guys have some thought or ideas how to make this upload authentificate inside CI ?

thank you very muchSmile


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-04-2010

[eluser]Ben Edmunds[/eluser]
Hugle,

Is the uploader code in your controller?

Please post some more code..


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-04-2010

[eluser]wgarcia[/eluser]
Hello guys,

I'm new with CI and I downloaded ion auth a few hours ago and installed in a clean CI installation. When I enter the login info (admin@admin.com, password) I get this message:

A Database Error Occurred
Error Number: 1046
No database selected
SELECT COUNT(*) AS `numrows` FROM (`users`) WHERE `email` = 'admin@admin.com'


Am I doing something wrong?
BTW, Ben, I would like to help translating it to spanish.

Thanks in advance


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-04-2010

[eluser]Ben Edmunds[/eluser]
wgarcia,

Do you have your database info correct in your database.php config file?

I'd love to get a spanish translation, you can either just email me the language file or fork the repo on github and do a pull request.



Thanks,


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-04-2010

[eluser]wgarcia[/eluser]
Haha sorry, that was it... I didn't filled the info in the database.php config file.

Another question, do I have to change something to use characters like "ñ, á, é, í..." in users name and last name? because if I use them I get a database error.

I'm reading the github help to understand how to do it Smile

Thanks a lot Ben


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-04-2010

[eluser]hugle[/eluser]
[quote author="Ben Edmunds" date="1273026978"]Hugle,

Is the uploader code in your controller?

Please post some more code..[/quote]

Hello Ben,
yeah, sure I can paste the code..

My controller is (it's extending the Admin Controller, where 'is_logged_in' is checked):
Code:
// basic controller function, it's just showing the view (it's Phil's template lib)
function manage($id = 0)
    {
        $this->template->build('index', $data);
    }

later, the view:
Code:
[removed]

$(function(){
    $('#swfupload-control').swfupload({
        upload_url: "/admin/categories/do_upload",
        file_post_name: 'uploadfile',
        file_size_limit : 102400, // 100MB
        file_types : "*.jpg;*.png;*.gif",
        file_types_description : "Image files",
        file_upload_limit : 10,
        flash_url : "<?php echo base_url(); ?>application/themes/admin/js/jquery/swfupload/swfupload.swf",
        button_image_url : '<?php echo base_url(); ?>application/themes/admin/js/jquery/swfupload/XPButtonUploadText_61x22.png',
        button_width : 61,
        button_height : 22,
        button_placeholder : $('#button')[0],
        debug: false
    })
        .bind('fileQueued', function(event, file){
            var listitem='<li id="'+file.id+'" >'+
                'File: <em>'+file.name+'</em> ('+Math.round(file.size/1024)+' KB) <span class="progressvalue" ></span>'+
                '<div class="progressbar" ><div class="progress" ></div></div>'+
                '<p class="status" >Pending</p>'+
                '<span class="cancel" >&nbsp;</span>'+
                '</li>';
            $('#log').append(listitem);
            var swfu = $.swfupload.getInstance('#swfupload-control');
            $('li#'+file.id+' .cancel').bind('click', function(){
                swfu.cancelUpload(file.id);
                $('li#'+file.id).slideUp('fast');
            });
            para(swfu);
            $(this).swfupload('startUpload');
        })
        .bind('fileQueueError', function(event, file, errorCode, message){
            alert('Size of the file '+file.name+' is greater than limit');
        })
        .bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){
            $('#queuestatus').text('Files Selected: '+numFilesSelected+' / Queued Files: '+numFilesQueued);
        })
        .bind('uploadStart', function(event, file){
            $('#log li#'+file.id).find('p.status').text('Uploading...');
            $('#log li#'+file.id).find('span.progressvalue').text('0%');
            $('#log li#'+file.id).find('span.cancel').hide();
        })
        .bind('uploadProgress', function(event, file, bytesLoaded){
            var percentage=Math.round((bytesLoaded/file.size)*100);
            $('#log li#'+file.id).find('div.progress').css('width', percentage+'%');
            $('#log li#'+file.id).find('span.progressvalue').text(percentage+'%');
        })
        .bind('uploadSuccess', function(event, file, serverData){
            alert(serverData);
            var item=$('#log li#'+file.id);
            item.find('div.progress').css('width', '100%');
            item.find('span.progressvalue').text('100%');
            var pathtofile='<a href="/uploads/'+file.name+'" target="_blank">view &raquo;</a>';
            item.addClass('success').find('p.status').html('Done! | '+pathtofile);
            
        })
        .bind('uploadComplete', function(event, file){
            $(this).swfupload('startUpload');
        })
        
        function para(s){
            s.addPostParam('test', $('#test').val());
        }
    
});    

[removed]


<div id="main">

    <h3>&lt;?php echo $title;?&gt;</h3>

    &lt;input type="text" id="test"  /&gt;    
    <div id="swfupload-control">
        &lt;input type="button" id="button" /&gt;
        <p id="queuestatus" ></p>
        <ol id="log"></ol>
    </div>


    &lt;?php if(isset($main))echo $main; ?&gt;

</div>

as you can see from the view, uploader calls :
Code:
upload_url: "/admin/categories/do_upload"

this function is:
Code:
function do_upload()
    {
        $config['upload_path'] = './uploads';
        $config['allowed_types'] = 'jpg|png';
        $config['max_size']    = '1000000000'; //large size
        $config['max_width']  = '102400';
        $config['max_height']  = '76800';
        $this->load->library('upload', $config);
        print_r($_POST);
        if(!$this->upload->do_upload('uploadfile')){
            $error = array('error' => $this->upload->display_errors());
            print_r ($error);
        }else{
            print_r($this->input->post('test'));
        }  
    }

print_r - is for debugging only purposes here...

and my Admin_Controller.php is having this line:
Code:
if (!$this->ion_auth->logged_in()) {
            redirect('auth/login', 'refresh');
        }

The SWF uploader does not upload the files, with this check.. if I comment out the 'redirect' line - it starts uploading smoothly..
As I read on the internet, it is somehow combiner with sessions etc, etc... but honestly, it didn't give me too much information Sad

Thanks for looking into my problem!
cheers


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-05-2010

[eluser]Ben Edmunds[/eluser]
The only suggestion I have without troubleshooting the code is to make sure the url you are linking to and the url you are linking from are on the same base_url. For example, if the user is one http://www.yoursite.com and you are linking to http://yoursite.com you may experience issues with the scope. You really shouldn't but I've had issues with that in the past.

If you want a temporary quick and dirty hack just change your admin controller to check for is_logged_in || $this->uri->segment(2) == 'do_upload'.

If you upload this somewhere and give me access to it I can help you more but nothing is really jumping out at me.


You can always email me too if you need more help.


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-05-2010

[eluser]hugle[/eluser]
[quote author="Ben Edmunds" date="1273104653"]The only suggestion I have without troubleshooting the code is to make sure the url you are linking to and the url you are linking from are on the same base_url. For example, if the user is one http://www.yoursite.com and you are linking to http://yoursite.com you may experience issues with the scope. You really shouldn't but I've had issues with that in the past.

If you want a temporary quick and dirty hack just change your admin controller to check for is_logged_in || $this->uri->segment(2) == 'do_upload'.

If you upload this somewhere and give me access to it I can help you more but nothing is really jumping out at me.


You can always email me too if you need more help.[/quote]

Hello Ben,

thanks for your time, I'll contact you soon, so we can discuss my problem..Smile and do not spam CI forumSmile))


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-05-2010

[eluser]Timothy_[/eluser]
Hello,

I am currently transitioning from Redux Auth 2 to Ion Auth.

I am using the new controller to handle all authentication. I have updated the config file to my sites settings. I have not changed anything in the database.

When I try and login I get the following error.

Quote:A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `0` = '[email protected]" at line 2

SELECT COUNT(*) AS `numrows` WHERE `0` = '[email protected]'

I have read through this thread and found someone had a similar problem. I have tried changing the "store salt" config value but as I said my database is still from Redux Auth 2.

Thanks

Tim