diff --git a/src/AuthenticationModule.php b/src/AuthenticationModule.php
index 3801a13..7818860 100644
--- a/src/AuthenticationModule.php
+++ b/src/AuthenticationModule.php
@@ -94,7 +94,10 @@ protected function registerUrlHandlers()
$className = $url->logoutLeafClassName;
return new $className($provider, $url->loginProviderClassName);
}),
- $url->activateChildUrl => $activate = new LeafCollectionUrlHandler($url->activatePasswordLeafClassName,$url->activatePasswordLeafClassName),
+ $url->onboardingChildUrl => $activate = new GreedyUrlHandler(function ($parentHandler, $captured) use ($url, $provider) {
+ $className = $url->onboardingPasswordLeafClassName;
+ return new $className($provider, $captured);
+ })
]),
$url->urlToProtect => $protected =
new ValidateLoginUrlHandler($provider, $url->loginUrl),
diff --git a/src/Emails/AccountOnboardingInvitationEmail.php b/src/Emails/AccountOnboardingInvitationEmail.php
new file mode 100644
index 0000000..bcfdd9f
--- /dev/null
+++ b/src/Emails/AccountOnboardingInvitationEmail.php
@@ -0,0 +1,52 @@
+absoluteWebsiteUrl}
+
+Below you will find a link which will allow you to set your password.
+
+Please note you must do this within 24 hours or you will need to request a new invitation.
+
+{$settings->absoluteWebsiteUrl}/login/activate/{$this->user->PasswordResetHash}/
+Text;
+ }
+
+ /**
+ * @return string
+ */
+ public function getSubject()
+ {
+ return 'Create Your Account';
+ }
+
+ public function getHtmlHeading()
+ {
+ return "
Create Your Account
";
+ }
+
+ public function getHtmlBody()
+ {
+ $settings = WebsiteSettings::singleton();
+
+ return <<You have recently been invited to {$settings->absoluteWebsiteUrl}
+
+Below you will find a link which will allow you to set your password.
+
+Please note you must do this within 24 hours or you will need to request a new invitation.
+
+Click to activate your account
+HtmlBody;
+ }
+}
\ No newline at end of file
diff --git a/src/Emails/ActivateAccountInvitationEmail.php b/src/Emails/ActivateAccountInvitationEmail.php
index 44ef0f5..8be8160 100644
--- a/src/Emails/ActivateAccountInvitationEmail.php
+++ b/src/Emails/ActivateAccountInvitationEmail.php
@@ -2,50 +2,8 @@
namespace Rhubarb\Scaffolds\Authentication\Emails;
-use Rhubarb\Crown\Settings\WebsiteSettings;
-
-class ActivateAccountInvitationEmail extends ResetPasswordInvitationEmail
+/** @deprecated use AccountOnboardingInvitationEmail */
+class ActivateAccountInvitationEmail extends AccountOnboardingInvitationEmail
{
- public function getText()
- {
- $settings = WebsiteSettings::singleton();
-
- return <<absoluteWebsiteUrl}
-
-Below you will find a link which will allow you to set your password.
-
-Please note you must do this within 24 hours or you will need to request a new invitation.
-
-{$settings->absoluteWebsiteUrl}/login/activate/{$this->user->PasswordResetHash}/
-Text;
- }
-
- /**
- * @return string
- */
- public function getSubject()
- {
- return 'Activate Your Account';
- }
-
- public function getHtmlHeading()
- {
- return "Activate Your Account
";
- }
-
- public function getHtmlBody()
- {
- $settings = WebsiteSettings::singleton();
-
- return <<You have recently been invited to {$settings->absoluteWebsiteUrl}
-
-Below you will find a link which will allow you to set your password.
-
-Please note you must do this within 24 hours or you will need to request a new invitation.
-Click to activate your account
-HtmlBody;
- }
}
\ No newline at end of file
diff --git a/src/Leaves/AccountOnboarding.php b/src/Leaves/AccountOnboarding.php
new file mode 100644
index 0000000..6d6b8ae
--- /dev/null
+++ b/src/Leaves/AccountOnboarding.php
@@ -0,0 +1,11 @@
+registerSubLeaf(
+ new Button("ActivateAccount", "Activate Account", function () {
+ $this->model->confirmPasswordResetEvent->raise();
+ })
+ );
+ }
+
+ protected function printViewContent()
+ {
+ $messages = $this->getMessages();
+
+ if (isset($messages[$this->model->message])) {
+ $closure = $messages[$this->model->message];
+
+ if (is_callable($closure)) {
+ print $closure();
+ } else {
+ print $closure;
+ }
+
+ return;
+ }
+
+ $this->layoutItemsWithContainer($this->getTitle(),
+ "{$this->getTitleParagraph()}
",
+ [
+ "Create your password" => "newPassword",
+ "Confirm your password" => "confirmNewPassword",
+ "" => "ActivateAccount"
+ ]
+ );
+ }
+
+ protected function getTitle()
+ {
+ return "Create your account";
+ }
+
+ protected function getTitleParagraph()
+ {
+ return "Create your account by setting your password.";
+ }
+
+ protected function getMessages()
+ {
+ $messages = [];
+
+ $messages['PasswordReset'] = <<Thanks, your account has now been activated. If you still have difficulties logging in you
+should contact us for assistance. We will never ask you for your password, but we should
+be able to reset it for you.
+PasswordReset;
+
+ $messages["PasswordsDontMatch"] = <<Sorry, the password entries you made do not match.
+Please enter your password again
+PasswordsDontMatch;
+
+ $messages["PasswordEmpty"] = <<Password and Confirm Password fields cannot be empty
+PasswordEmpty;
+
+ $messages["UserNotRecognised"] = <<Sorry, the user account you are attempting to reset has not been recognised.
+Please ask for a new invitation
+PasswordsDontMatch;
+
+ $messages['HashInvalid'] = <<Sorry, your activation link has expired or is not recognised.
+Please ask for a new invitation
+HashInvalid;
+
+ return $messages;
+ }
+}
\ No newline at end of file
diff --git a/src/Leaves/ActivateAccount.php b/src/Leaves/ActivateAccount.php
index d1bac50..bb6aeef 100644
--- a/src/Leaves/ActivateAccount.php
+++ b/src/Leaves/ActivateAccount.php
@@ -2,10 +2,8 @@
namespace Rhubarb\Scaffolds\Authentication\Leaves;
-class ActivateAccount extends ConfirmResetPassword
+/** @deprecated use AccountOnboarding */
+class ActivateAccount extends AccountOnboarding
{
- protected function getViewClass()
- {
- return ActivateAccountView::class;
- }
+
}
\ No newline at end of file
diff --git a/src/Leaves/ActivateAccountView.php b/src/Leaves/ActivateAccountView.php
index 787a70c..39ad09e 100644
--- a/src/Leaves/ActivateAccountView.php
+++ b/src/Leaves/ActivateAccountView.php
@@ -2,86 +2,8 @@
namespace Rhubarb\Scaffolds\Authentication\Leaves;
-use Rhubarb\Leaf\Controls\Common\Buttons\Button;
-
-class ActivateAccountView extends ConfirmResetPasswordView
+/** @deprecated use AccountOnboardingView */
+class ActivateAccountView extends AccountOnboardingView
{
- protected function createSubLeaves()
- {
- parent::createSubLeaves();
-
- $this->registerSubLeaf(
- new Button("ActivateAccount", "Activate Account", function () {
- $this->model->confirmPasswordResetEvent->raise();
- })
- );
- }
-
- protected function printViewContent()
- {
- $messages = $this->getMessages();
-
- if (isset($messages[$this->model->message])) {
- $closure = $messages[$this->model->message];
-
- if (is_callable($closure)) {
- print $closure();
- } else {
- print $closure;
- }
-
- return;
- }
-
- $this->layoutItemsWithContainer($this->getTitle(),
- "{$this->getTitleParagraph()}
",
- [
- "Enter new password" => "newPassword",
- "Enter again to confirm" => "confirmNewPassword",
- "" => "ActivateAccount"
- ]
- );
- }
-
- protected function getTitle()
- {
- return "Activate your account";
- }
-
- protected function getTitleParagraph()
- {
- return "Activate your account by setting your password.";
- }
-
- protected function getMessages()
- {
- $messages = [];
-
- $messages['PasswordReset'] = <<Thanks, your account has now been activated. If you still have difficulties logging in you
-should contact us for assistance. We will never ask you for your password, but we should
-be able to reset it for you.
-PasswordReset;
-
- $messages["PasswordsDontMatch"] = <<Sorry, the password entries you made do not match.
-Please enter your password again
-PasswordsDontMatch;
-
- $messages["PasswordEmpty"] = <<Password and Confirm Password fields cannot be empty
-PasswordEmpty;
-
- $messages["UserNotRecognised"] = <<Sorry, the user account you are attempting to reset has not been recognised.
-Please ask for a new invitation
-PasswordsDontMatch;
-
- $messages['HashInvalid'] = <<Sorry, your activation link has expired or is not recognised.
-Please ask for a new invitation
-HashInvalid;
- return $messages;
- }
}
\ No newline at end of file
diff --git a/src/Settings/ProtectedUrl.php b/src/Settings/ProtectedUrl.php
index ca3e382..ea5736e 100644
--- a/src/Settings/ProtectedUrl.php
+++ b/src/Settings/ProtectedUrl.php
@@ -2,7 +2,7 @@
namespace Rhubarb\Scaffolds\Authentication\Settings;
-use Rhubarb\Scaffolds\Authentication\Leaves\ActivateAccount;
+use Rhubarb\Scaffolds\Authentication\Leaves\AccountOnboarding;
use Rhubarb\Scaffolds\Authentication\Leaves\ConfirmResetPassword;
use Rhubarb\Scaffolds\Authentication\Leaves\Login;
use Rhubarb\Scaffolds\Authentication\Leaves\Logout;
@@ -23,8 +23,8 @@ class ProtectedUrl
public $resetPasswordLeafClassName = ResetPassword::class;
public $confirmResetPasswordLeafClassName = ConfirmResetPassword::class;
- public $activateChildUrl = 'activate/';
- public $activatePasswordLeafClassName = ActivateAccount::class;
+ public $onboardingChildUrl = 'activate/';
+ public $onboardingPasswordLeafClassName = AccountOnboarding::class;
public function __construct($urlToProtect, $loginProviderClassName, $loginUrl)
{
diff --git a/src/UseCases/SendAccountOnboardingInvitationEmailUseCase.php b/src/UseCases/SendAccountOnboardingInvitationEmailUseCase.php
new file mode 100644
index 0000000..4748a91
--- /dev/null
+++ b/src/UseCases/SendAccountOnboardingInvitationEmailUseCase.php
@@ -0,0 +1,18 @@
+generatePasswordResetHash();
+ $resetPasswordEmail = Container::instance(AccountOnboardingInvitationEmail::class, $user);
+ EmailProvider::selectProviderAndSend($resetPasswordEmail);
+ }
+}
\ No newline at end of file
diff --git a/src/UseCases/SendActivateAccountInvitationEmailUseCase.php b/src/UseCases/SendActivateAccountInvitationEmailUseCase.php
index 6e5e3b2..14cabff 100644
--- a/src/UseCases/SendActivateAccountInvitationEmailUseCase.php
+++ b/src/UseCases/SendActivateAccountInvitationEmailUseCase.php
@@ -1,18 +1,11 @@
generatePasswordResetHash();
- $resetPasswordEmail = Container::instance(ActivateAccountInvitationEmail::class, $user);
- EmailProvider::selectProviderAndSend($resetPasswordEmail);
- }
+
}
\ No newline at end of file