Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
7603 มุมมอง

Hello,

odoo 8 automatic logout / session expiry after 10 min if browser is ideal.

Thanks in advance... 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

See (and modify) method session_gc in http.py, like this:

def session_gc(session_store):
if random.random() < 0.01: ###!!! 0.001:
# we keep session one week
last_week = time.time() - 60*10 ###!!! 60*60*24*7
for fname in os.listdir(session_store.path):
path = os.path.join(session_store.path, fname)
try:
if os.path.getmtime(path) < last_week:
os.unlink(path)
except OSError:
pass

อวตาร
ละทิ้ง

@zbik,

Thanks for the code, it's very useful. Do you have any suggestions on how this code might be modified so that no core files are modified?

I think this would be incredibly useful as a standalone module, and this would allow it to be upgrade proof as well.

ผู้เขียน

Hello zbik, Can you please explain excatly what modify i need to do to set 10 min logout...?? Thanks.

Answer updated

ผู้เขียน

Hello zbik, Thanks for your answer, i test this code its work fine. but only 1 time it work, after i updated the code and restart the server it work, now its not working. can you please help me, what i am missing... Thanks.

After update Odoo code from repository file http.py (and method session_gc) is replaced and set as original.

ผู้เขียน

I replace the code as you post in answer, and first time its work for testing i put for 1 min. so, its should logout after 1 min if browser is ideal, after logout first time in 1 min, i login again and then now its not logout...

Random set, such as 0.1 or 1.0 and tests (0.1 - in this case an average of 10 refreshes generates log off), the logout time is set to 10 minutes.

ผู้เขียน

Thanks zbik

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
พ.ย. 19
2740
1
มี.ค. 18
7960
0
ก.ย. 21
200
1
มี.ค. 23
6933
1
เม.ย. 22
3517