how to intercept user login with cookie
hi, is there a way for intercept a user when login via cookie? For example, when a user login with a form (no cookie stored) is possible to intercept them with hook user: function hook_user($type, &$edit, &$user, $category = FALSE) { if ($type == 'login') { Thanks a lot Vita
I think what you need happens in sesson.inc function sess_read($key) { ... $user = db_fetch_object(db_query("SELECT u.*, s.* FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = '%s'", $key)); // We found the client's session record and they are an authenticated user if ($user && $user->uid > 0) { // user logged in via cookie Not sure if there is a way to do that via a hook. Perhaps extending hook_user to do that is a good idea. http://api.drupal.org/api/5/function/hook_user On 4/3/07, vitamona <vitamona@gmail.com> wrote:
hi, is there a way for intercept a user when login via cookie?
For example, when a user login with a form (no cookie stored) is possible to intercept them with hook user:
function hook_user($type, &$edit, &$user, $category = FALSE) { if ($type == 'login') {
Thanks a lot
Vita
-- 2bits.com http://2bits.com Drupal development, customization and consulting.
Hi, I've changed my lgin to be done in a dedicated div (not the /user page). I need to give a message upon a failed login which does not show now(is this the same area for implementation -catching the failed login and drupal_set_messaging it?) How can I do it without interveeing with core... Lior On 4/3/07, Khalid Baheyeldin <kb@2bits.com> wrote:
I think what you need happens in sesson.inc
function sess_read($key) { ... $user = db_fetch_object(db_query("SELECT u.*, s.* FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = '%s'", $key));
// We found the client's session record and they are an authenticated user if ($user && $user->uid > 0) { // user logged in via cookie
Not sure if there is a way to do that via a hook.
Perhaps extending hook_user to do that is a good idea.
http://api.drupal.org/api/5/function/hook_user
On 4/3/07, vitamona <vitamona@gmail.com> wrote:
hi, is there a way for intercept a user when login via cookie?
For example, when a user login with a form (no cookie stored) is possible to intercept them with hook user:
function hook_user($type, &$edit, &$user, $category = FALSE) { if ($type == 'login') {
Thanks a lot
Vita
-- 2bits.com http://2bits.com Drupal development, customization and consulting.
-- --- ליאור קסוס , לינוויט http://www.linnovate.net
2007/4/3, Khalid Baheyeldin <kb@2bits.com>:
I think what you need happens in sesson.inc
[...]
Not sure if there is a way to do that via a hook.
oh, i i'm developing developing a module for both drupal 4.7 and 5
Perhaps extending hook_user to do that is a good idea.
in user.module (drupal 4.7) there is function user_login_validate($form_id, $form_values) this function check if an username is blocked by admin. if the user access with a cookie, to some page, drupal unset the cookie and make user as an anonymous. how? I need to implement the same thing (in a module) but with my personal option checking. Is it possible? Many thanks
participants (3)
-
Khalid Baheyeldin -
Lior Kesos -
vitamona