title: Hook into Drupal registration and validate user info against business logic
body: <p>I want to hook into the registration module. I already have a database of 50000 users who use my old website. Now I am migrating to Drupal.</p>
  
  <p>I still haven't migrated the entries to drupal database. I will be checking against my old database.</p>
  
  <p>When a user tries to register in Drupal, I need to check whether the username he gave is already present in that list of 50000 (and growing) entries. If it exists, I need to cancel the registration showing an error msg saying username exists..</p>
  
  <p>Which hook should I use? If my code figures that the validation failed, How can I tell drupal to display an error msg?</p>
  
  <p><strong>Edit: I hooked into the hook_user and checked for the 'validate' op. I am able to validate and assign error messages. But it is happening for all forms. I want to validate only the new account creation form. How can I do that?</strong></p>
  
  <p>Thanks.</p>