Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2 Ehh: Added option to pre-fill recovery email via url parameter #564

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
run: vendor/bin/phpstan analyse

- name: Archive failed tests artifacts - test output & log
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-outputs-php-${{ matrix.php-versions }}
Expand Down
8 changes: 6 additions & 2 deletions src/User/Controller/RecoveryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,18 @@ public function actionRequest()
throw new NotFoundHttpException();
}

$request = Yii::$app->request;

/** @var RecoveryForm $form */
$form = $this->make(RecoveryForm::class, [], ['scenario' => RecoveryForm::SCENARIO_REQUEST]);

if(!$request->getIsPost() && !empty($request->get('email'))) {
$form->email = $request->get('email');
}
$event = $this->make(FormEvent::class, [$form]);

$this->make(AjaxRequestModelValidator::class, [$form])->validate();

if ($form->load(Yii::$app->request->post()) && $form->validate()) {
if ($form->load($request->post()) && $form->validate()) {
$this->trigger(FormEvent::EVENT_BEFORE_REQUEST, $event);

$mailService = MailFactory::makeRecoveryMailerService($form->email);
Expand Down
1 change: 1 addition & 0 deletions src/User/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ class Module extends BaseModule
'<action:(register|resend)>' => 'registration/<action>',
'confirm/<id:\d+>/<code:[A-Za-z0-9_-]+>' => 'registration/confirm',
'forgot' => 'recovery/request',
'forgot/<email:[a-zA-Z0-9_.±]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+>' => 'recovery/request',
'recover/<id:\d+>/<code:[A-Za-z0-9_-]+>' => 'recovery/reset'
];
/**
Expand Down
Loading