You are here

Drupal: IP Login in IP Login 6

IP Login: automatic login via ip address

ABOUT

This module allows users to login first automatically via their IP address, instead of using a username / password.

HOW IT WORKS

When a user visits any Drupal page, IP Login:

  1. Checks if the user is not logged in and that IP login hasn't run yet for this session.
  2. If true, the module checks if a profile record exists for the user's IP address ( found in $_SERVER['REMOTE_ADDR'] ) by looking up the profile_values field in the DB.
  3. If a record is found in profile_values, IP Login logs the user in programmatically as the user with the matching IP address. Wildcard IP addresses such as 123.456.789.* are also available for corporate IP ranges etc...
  4. If a matching IP is not found, normal username / password authentication is still always available as a second step.

Note: The module uses the core 'Profile' module to store a user's IP address in a profile module field.

HOW TO INSTALL

  1. To associate an IP address with a user, create a user profile textfield ( admin/user/profile > add new field ) e.g: profile_ip. I recommend making it a private field, only available to admins. This will hold your user's ip address.
  2. Extract the archive and copy the module folder 'ip_login' to your module folder (e.g sites/all/modules/ )
  3. Enable the module from Drupal admin -> modules
  4. Go to the IP Login site config settings at admin/settings/iplogin and select the profile field that contains a user's IP address.
  5. Done.

HOW TO TEST

You can test it by entering your IP address in your user profile.

  1. If it's a local dev copy of the site, you can probably use localhost 127.0.0.1 for testing.
  2. You can tell it's working when you click the logout button and are logged back in by IP Login.
  3. IP Login displays a welcome message: "Welcome %name, you're now logged into %sitename"
  4. You should also be able to close the browser, open it, go to your site and see the welcome message indicating IP Login has logged you in.

Note: If you, or your users, need to find your/their external IP address, try http://whatismyip.com

Please Note:

  • This module is not suitable for use with users who have dynamically assigned, changing, IP addresses. This is because another user may login when assigned the same IP address as a previous valid user. It is however suitable for use with users who always access your site from a static IP.
  • This module does not write to the profile_ip field. Adding the user's IP address should be done manually by the website administrator or privileged user.

File

readme.html
View source
<html>
  <head>
    <title>Drupal: IP Login</title>
  </head>
  <body>
  <h2>IP Login: automatic login via ip address</h2>
  <h3>ABOUT</h3>
  <p>This module allows users to login first automatically via their IP address, instead of using a username / password.</p>
  <h3>HOW IT WORKS</h3>
  <p>When a user visits any Drupal page, IP Login: </p>
  <ol>
  <li>Checks if the user is not logged in and that IP login hasn't run yet for this session.</li>
  <li>If true, the module checks if a profile record exists for the user's IP address ( found in $_SERVER['REMOTE_ADDR'] ) by looking up the profile_values field in the DB.</li>
  
  <li>If a record is found in profile_values, IP Login logs the user in programmatically as the user with the matching IP address. Wildcard IP addresses such as 123.456.789.* are also available for corporate IP ranges etc...</li>
  <li>If a matching IP is not found, normal username / password authentication is still always available as a second step.</li>
  </ol>
  <p><b>Note:</b> The module uses the core 'Profile' module to store a user's IP address in a profile module field.</p>
  <h3>HOW TO INSTALL</h3>
  <ol>
  <li>To associate an IP address with a user, create a user profile textfield ( admin/user/profile &gt; add new field ) e.g: profile_ip. I recommend making it a private field, only available to admins. This will hold your user's ip address.</li>
  <li>Extract the archive and copy the module folder 'ip_login' to your module folder (e.g sites/all/modules/ )</li>
  
  <li>Enable the module from Drupal admin -&gt; modules</li>
  <li>Go to the IP Login site config settings at admin/settings/iplogin and select the profile field that contains a user's IP address.</li>
  <li>Done.</li>
  </ol>
  <h3>HOW TO TEST</h3>
  <p>You can test it by entering your IP address in your user profile. </p>
  <ol>
  <li>If it's a local dev copy of the site, you can probably use localhost 127.0.0.1 for testing.</li>
  <li>You can tell it's working when you click the logout button and are logged back in by IP Login.</li>
  
  <li>IP Login displays a welcome message: "Welcome %name, you're now logged into %sitename"</li>
  <li>You should also be able to close the browser, open it, go to your site and see the welcome message indicating IP Login has logged you in.</li>
  </ol>
  <p><b>Note: </b> If you, or your users, need to find your/their external IP address, try <a href="http://whatismyip.com" title="http://whatismyip.com" rel="nofollow">http://whatismyip.com</a></p>
  <h2>Please Note:</h2>
  <ul>
  <li>
  This module is <b>not</b> suitable for use with users who have dynamically assigned, changing, IP addresses. This is because another user may login when assigned the same IP address as a previous valid user. It is however suitable for use with users who always access your site from a static IP.</li>
  
  <li>This module does <b>not</b> write to the profile_ip field. Adding the user's IP address should be done manually by the website administrator or privileged user.</li>
  </body>
</html>