rainlab/user-plugin

No Flash Messages in some situations

Closed this issue · 1 comments

No Flash Message if the user is registered and activated directly
If you've set your account so it's activated automatically, you don't get any flash messages that this process was succesfull.
Feels a bit irritating.
I dont use the form_ajax, I use form_open

This would be the solution:
Account.php, Line 359

            // Automatically activated or not required, log the user in
            if ($automaticActivation || !$requireActivation) {
                Flash::success(Lang::get('rainlab.user::lang.account.activation_automatically')); // Add this...
                Auth::login($user, $this->useRememberLogin());
                $intended = true;
            }

This here is my workaround, but .... seems better to add the solution from above

        Event::listen('rainlab.user.register', function ($user) {
            Flash::success('Registration successfull!');
        });

No Flash Message on Login
It should probably go around line 275 within onSignin() of the Account.php

Here's my workaround for now:

        Event::listen('rainlab.user.login', function ($user) {
            Flash::success(trans(
                'myplugin.general::lang.flash.login',
                ['user' => $user->username]
            ));
        });

and from the lang file:

    'flash' => [
        'login' => 'Welcome back :user!',
    ]

Your workarounds are a good solution to this requirement.