ColdTrick / profile_manager

Manage profile fields for users and groups in Elgg
https://elgg.org/plugins/385114
30 stars 32 forks source link

correctly add register action validation middleware #124

Closed jeabakker closed 4 years ago

jeabakker commented 4 years ago

Currently it's overruling all middleware

ref: https://github.com/Elgg/Elgg/issues/12952

rohit1290 commented 4 years ago

I am not sure if this is the ideal solution but adding the below mentioned code at the beginning of "validateRegisterAction" function within the User class solved my problem.

Adding this:

$hook_params = ['request' => $request];
$result = $request->elgg()->hooks->trigger('action:validate', 'register', $hook_params, true);
if (!$result) {
    return;
}

at this location: https://github.com/ColdTrick/profile_manager/blob/388917b49b0f56aa44c341dc05df77a053180908/classes/ColdTrick/ProfileManager/Users.php#L151

Please let me know if this looks fine. I will create a PR for this. Request you to please reply at the earliest as I want this issue to be resolved. I am getting too many spammers in my site and as long as this issue wont be fixed SpamLoginFilter plugin won't work.

rohit1290 commented 4 years ago

@jeabakker , @jdalsem - Any update for my comment above?

jeabakker commented 4 years ago

it should be fixed by adding the ActionMiddleware middleware here https://github.com/ColdTrick/profile_manager/blob/388917b49b0f56aa44c341dc05df77a053180908/elgg-plugin.php#L67