I am using Drupal 7. I need any user(who has not logged in) to just see the login screen only for authentication before he can traverse the actual website.
How this can be done?I tried to do it using Panels but without success.
You can use this module
The LoginToboggan module offers several modifications of the Drupal login system in an external module by offering the following features and usability improvements:
- Allow users to login using either their username OR their e-mail address.
- Allow users to login immediately.
- Provide a login form on Access Denied pages for non-logged-in (anonymous) users.
- The module provides two login block options: One uses JavaScript to display the form within the block immediately upon clicking "log in". The other brings the user to a separate page, but returns the user to their original page upon login.
- Customize the registration form with two e-mail fields to ensure accuracy.
- Optionally redirect the user to a specific page when using the 'immediate login' feature.
- Optionally redirect the user to a specific page upon validation of their e-mail address.
- Optionally display a user message indicating a successful login.
- Optionally combine both the login and registration form on one page.
- Optionally have unvalidated users purged from the system at a pre-defined interval.
- Integrates with the Rules module to do various tasks when a user validates via email validation process (see http://drupal.org/node/880904 for an example).
Or you can add this code as well:
global $user
if ($user->uid == 0 && $_GET['q'] == 'node') {
drupal_set_message("Access Denied: Please Login");
drupal_goto('user/login', drupal_get_destination());
}