// Make sure signups are enabled before proceeding
if ($conf['signup']['allow'] !== true || !$auth->hasCapability('add')) {
$notification->push(_("User Registration has been disabled for this site."), 'horde.error');
$registry->getServiceLink('login')->redirect();
}
try {
$signup = $injector->getInstance('Horde_Core_Auth_Signup');
} catch (Horde_Exception $e) {
Horde::log($e, 'ERR');
$notification->push(_("User Registration is not properly configured for this site."), 'horde.error');
$registry->getServiceLink('login')->redirect();
}
$vars = $injector->getInstance('Horde_Variables');
$formsignup = new Horde_Core_Auth_Signup_Form($vars);
if ($formsignup->validate()) {
$formsignup->getInfo($vars, $info);
$error = $success_message = null;
if ($info instanceof PEAR_Error) {
$notification->push(sprintf(_("There was a problem adding \"%s\" to the system: %s"), $vars->get('user_name'), $info->getMessage()), 'horde.error');
} else {
if (!$conf['signup']['approve']) {
/* User can sign up directly, no intervention necessary. */
try {
$signup->addSignup($info);
$success_message = sprintf(_("Added \"%s\" to the system. You can log in now."), $info['user_name']);
} catch (Horde_Exception $e) {
$error = $e;
}
} elseif ($conf['signup']['approve']) {
/* Insert this user into a queue for admin approval. */
try {