05-13-2018, 05:21 PM
Hi Brandin!
It seems I achieved the solution. Just added the following in the file custom_login_script.php and a user wont be able to login in more than one time simultaneously. To test: open a session in one device and, then, try to login another session (same user, of course) from another device or even from an browser private navigation window.
<?php
//Whatever you put here will happen after the username and password are verified and the user is "technically" logged in, but they have not yet been redirected to their starting page. This gives you access to all the user's data through $user->data()
$db->query("UPDATE us_user_sessions SET UserSessionEnded=1,UserSessionEnded_Time=NOW() WHERE UserSessionEnded=0 AND fkUserID=?", [$_SESSION['user']]);
Redirect::to($us_url_root.'users/account.php');
?>
Please, could you verify if the way I did to logoff previously opened session is "a nice one"?
Thank you!
Demilson
PS: I've just found the file oauth_success_redirect.php inside userc/includes . Should I use it instead of custom_login_script.php ?
It seems I achieved the solution. Just added the following in the file custom_login_script.php and a user wont be able to login in more than one time simultaneously. To test: open a session in one device and, then, try to login another session (same user, of course) from another device or even from an browser private navigation window.
<?php
//Whatever you put here will happen after the username and password are verified and the user is "technically" logged in, but they have not yet been redirected to their starting page. This gives you access to all the user's data through $user->data()
$db->query("UPDATE us_user_sessions SET UserSessionEnded=1,UserSessionEnded_Time=NOW() WHERE UserSessionEnded=0 AND fkUserID=?", [$_SESSION['user']]);
Redirect::to($us_url_root.'users/account.php');
?>
Please, could you verify if the way I did to logoff previously opened session is "a nice one"?
Thank you!
Demilson
PS: I've just found the file oauth_success_redirect.php inside userc/includes . Should I use it instead of custom_login_script.php ?