0

I would like to prevent my users to login except for those who login through my REST Service.

Is that possible?

1

It sounds like the login_disable module will do exactly what you need.

Prevent users from logging in to your Drupal site unless they know the secret key to add to the end of the login form page. ( default: http://example.com/?q=user/login&admin )

If your site has clean urls enabled you may use http://example.com/user/login?admin instead.

That way you can set a secret key so only users who know that key are able to log in using the login form.

Another possible solution would be to disable the login form completely, like this:

function MY_MODULE_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'user_login') {
    $form['#access'] = FALSE;
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.