From 01b994601bc4cd974fcf45aea3620fdbf7ec2e84 Mon Sep 17 00:00:00 2001 From: Leon Date: Wed, 17 Jun 2020 22:41:54 +0200 Subject: [PATCH] Register added --- core/Api/User/Register.php | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 core/Api/User/Register.php diff --git a/core/Api/User/Register.php b/core/Api/User/Register.php new file mode 100644 index 0000000..b8cfad2 --- /dev/null +++ b/core/Api/User/Register.php @@ -0,0 +1,46 @@ +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; + } +} \ No newline at end of file