Registration

Submitted by meiji00 on 2013-01-17

Hey again, is it possible to enable the registration of accounts in a local area network?

Thanks

You can check $_SERVER[ 'REMOTE_ADDR' ] to see if it's in the local network's range and set $this->canRegister to false to hide the register link in the login form.

To prevent users from circumventing this by typing the URL directly, you can also include this check in register.php and throw an error.

Regards,
Michał

Rovy Ray Perlas

Here it is Im trying to allow registration on a local network, I've tried enabling it at first and configuring the Email Server (even thought it wont work because its only a local network) and set the cron job in task scheduler because it's a requirement.
Then when I register and click the submit button, an error occurs.

I dont want to hide the register link, i want to allow it running in a local network.

Here it is right?
public function getHostName()
{
if ( !empty( $_SERVER[ 'REMOTE_HOST' ] ) )
return $_SERVER[ 'REMOTE_HOST' ];
if ( !empty( $_SERVER[ 'REMOTE_ADDR' ] ) )
return $_SERVER[ 'REMOTE_ADDR' ];
return 'unknown';
}

Is it possible?

Thanks.

Oh, so you basically want to be able to use the registration function without an email server.

In the register() function in register.php, call $this->activate( $key ) right after addRequest() and remove the rest of the code which creates and sends the email. Also remove the code that sends emails from the admin/register/approve.php and reject.php pages.

You don't need the cron job because it's only used to send notifications to the administrator about pending requests.

If your server is not available from outside the local network, there is no need to protect access to the registration function.

Regards,
Michał

Rovy Ray Perlas

Wow okay thanks it worked! yeah!
So i just need a dummy informations just to fill up the required details to activate the registration link in the email server.

Thanks a lot!

Rovy Ray Perlas

Now how can I complete a Registration even if I dont want the Email Address to be filled up.
I want to delete the Email Registration Requirement when Registering for an Account.
How can I do that?

Thanks.

I think it should be enough to modify the following line in registration page:

$this->form->addTextRule( 'email', System_Const::NameMaxLength );

to this:

$this->form->addTextRule( 'email', System_Const::NameMaxLength, System_Api_Parser::AllowEmpty );

Regards,
Michał

Rovy Ray Perlas

Thanks. I removed the try catch in validate() because it still says invalid email.

Thanks a lot!