benedmunds / CodeIgniter-Ion-Auth

Simple and Lightweight Auth System for CodeIgniter
http://benedmunds.com/ion_auth/
MIT License
2.34k stars 1.14k forks source link

Forcing uses back to the login screen #1116

Closed stephenad closed 6 years ago

stephenad commented 7 years ago

Hi all

With Ion Auth, is there a way to force a user sessoin timeout so that they are taken back to the login screen so that they have to login again?

Thanks Andy

benedmunds commented 7 years ago

You can could ion_auth->logout() and then redirect('/login')

stephenad commented 7 years ago

Hi Ben,

Thanks for the reply, but how do I set the session timeout period?

Andy

benedmunds commented 7 years ago

You can set that in the config.

stephenad commented 7 years ago

Hi Ben, Thanks for the reply.

I am new to code igniter and am working on a client system from a predecessor so still getting to grips with this.

Are you referring to the variable $config['user_expire'] = 86500;

Or is there a different one I should be using as that one does not seem to work for me.

Thanks Andy

benedmunds commented 7 years ago

It'll be "sess_expiration" in your CodeIgniter config.php

stephenad commented 7 years ago

Hi Ben,

Thanks for the reply I will take a look at that.

Andy

benedmunds commented 7 years ago

👍

stephenad commented 7 years ago

Hi Ben,

I have set both the sess_expiration and the csrf_expire to 300; ie 5 minutes, but they do not seems to time me out. Do I need to do something else in code igniter or ion_auth for these variable to take effect?

$config['sess_expiration'] = 300; $config['csrf_expire'] = 300;

Sorry for all the questions I really appreciate the help.

Andy

benedmunds commented 7 years ago

Are you sure you dont have remember_me or some other function that's renewing the session?

benedmunds commented 6 years ago

Closing due to inactivity. Feel free to reopen if the problem persists.