Registration only for specific domains (like for instance @company.com)

How can i grand users with a certain (company) e-mail address to register and how do i monitor this? Is there a code snippet to do this?
Thanx.

Please check this topic No-Bot Registration | HivePress Support

Hi, may be you can help me. With the use of the script on Allow registration for certain email domain on WordPress - CodeSpeedy i can filter new registrars for the site and get the green light (see screenshot were a registration is stopped), but only through the WordPress registration form. When I try it through the use of the registration form of rentalhives form, nothing happens and a new user with an e-mail domain that is not allowed can register?!?
RentalHives is using the same login and registration form as WordPress, i read in the documentation. But why is this not working?

Yes, we use the same functions and the default WP registration form but I guess the plugin you’re using is applied to APIs specific to the default form, so it doesn’t work for the front-end one.

If there are only a few allowed domains, you can try using this code snippet instead of a plugin. The current code snippet accepts only Gmail and Yahoo email domains on the registration form but you can change them by your requirements:

add_filter(
	'hivepress/v1/forms/user_register/errors',
	function( $errors, $form ) {
		$email = $form->get_value( 'email' );

		if ( $email && ! in_array(
			hivepress()->helper->get_last_array_value( explode( '@', $email ) ),
			[
				'gmail.com',
				'yahoo.com',
			],
			true
		) ) {
			$errors[] = 'error text here';
		}
		
		return $errors;
	},
	1000,
	2
);