Custom login for specific role On a site there are some pages from a Content-type. Some of those pages (for the Belgium language only) need to be only accessible for Dokters.

So when you try to reach the URL of one of those pages you are redirected to a login-page.

But the role 'dokters' needs to have an extra login-field. Or only this field to login is even better if thats possible! It should be a field with 11 digits. Or if this is to complicated (Username, Password, 11-digit field).

How (which modules) are best practices to built this functionality?

UPDATE:

Now i managed to do a workaround with Content Access module. I made a role 'doctor'. And now only users with role 'doctor' can access those pages.

But is there something to do like when the Doctors visit those restricted pages they are redirected to a custom login-page. On this page you have a small form: Fill in your 11-digit code to access this page.

Because all doctors have their own 11-digit code. We don't have to send all doctors the username name and password for role 'doctor', instead they can access the content directly, with their 11-digit code! The only validation should be that the field contains 11 digits.

How do i manage this in the simplest/best way?
First, create a custom permission:

/**
 * Implements hook_permission().
 */
function MY_MODULE_permission() {
  return array(
    'access doctor content' =&gt; array(
      'title' =&gt; t('Access content for doctors'),
    )
  );
}


If the restricted content is a custom page you can do this:

/**
* Implements hook_menu().
*/
function MY_MODULE_menu() {
  $items = array();    
  $items['doctor_page'] = array(
    'title' =&gt; 'Doctor page',
    'page callback' =&gt; '_doctor_page_content',
    'access arguments' =&gt; array('access doctor content'),
    'type' =&gt; MENU_NORMAL_ITEM,
  );
  return $items;
}


If the restricted content is a node make sure there is a reliable way to filter that content in your code (e.g. by adding a checkbox 'Protected' to the node). Set access restrictions on nodes like this:

/**
 * Implements hook_node_access().
 */
function MY_MODULE_node_access($node, $op, $account) {
  // Check if the content is protected.
  if (!empty($node-&gt;field_protected_content[LANGUAGE_NONE][0]['value'])) {
    // If so, check if the user has access to it.
    if (user_access('access doctor content', $account)) {
      // Allow access.
      return NODE_ACCESS_ALLOW;
    }
    // Deny access.
    return NODE_ACCESS_DENY;
  }

  // Handle the default restrictions.
  return NODE_ACCESS_IGNORE;
}


Don't forget to add your custom permission to the user role via the permissions page (admin/people/permissions).