user->isLoggedIn()) {
$this->lastError = L('You are already logged in');
$this->success = false;
return false;
}
if (!parent::execute($values)) {
return false;
}
if($this->success) {
$email = $this->getParam('email');
$token = generateRandomString(36);
$request = new SendMail($this->user);
$link = "http://localhost/acceptInvitation?token=$token";
$this->success = $request->execute(array(
"from" => "webmaster@romanh.de",
"to" => $email,
"subject" => "Account Invitation for web-base@localhost",
"body" =>
"Hello,
you were invited to create an account on web-base@localhost. Click on the following link to confirm the registration, it is 48h valid from now.
If the invitation was not intended, you can simply ignore this email.
$link"
)
);
$this->lastError = $request->getLastError();
}
return $this->success;
}
}