views:

714

answers:

2

I'm working on a Drupal based system that will not be directly handling login processing.

Rather, another system will be handling the user authentication and transmitting the data directly into Drupal via a GET parameter.

Can I hook into a function that will process that GET parameter and verify the User?

I'm coming into the development of this system late and many things have already been chosen for me so I'm left to work with what has already be developed. Any advice would be greatly appreciated!

A: 

Why not just check $_GET in the function that defines the form? You can then call user_authenticate( $form_values ).

http://api.drupal.org/api/function/user%5Fauthenticate/6

You could also just check the credentials in $_GET when the form is submitted using a validation hook.

http://api.drupal.org/api/drupal/developer--topics--forms%5Fapi%5Freference.html#validate

You could then use form_set_error() like you would for any other validation error, but I gather this is not acceptable?

ctford
Is it possible to do the validation without having a form submitted?
PrairieHippo
No, the form validation is done on form submit.
ctford
+3  A: 

I was able to accomplish what I needed by using hook_init() and user_external_login_register().

Not quite sure why I didn't think of it before!

PrairieHippo
Thanks for taking the time to report your solution. You may want to accept this answer to show it's what solved the problem for you.
ctford
Thanks ctford! I'm still pretty new to how SO works.
PrairieHippo
+1 for answering own question with found solution
Henrik Opel

related questions