Yes, you should include your php file in functions.php
in WordPress theme folder.
In functions.php : require( 'your_php_file' );
And write :
<?php
add_action( 'init', 'fetch_login_form');
function fetch_login_form() {
$user_email = $_POST['user_email'];
// write condition based on Username or User email.
}
Password is autogenerated while we receive an email so you can stop send email and allow user to register directly. Follow this link : How to disable wordpress confirmation email for new users