rainlab/user-plugin

How to activate an account if I cannot login and need the mail a second time

Closed this issue · 5 comments

Settings:

  • Activation mode: User (The user activates their own account using mail.)
  • Sign in requires activation : true

Scenario:

  • User registers an account an the email does not arrive for unknown reasons
  • The user wants to resed the activation email, but he cant:
    => He cannot login since his account is not active, so this form does not help: {% partial __SELF__ ~ '::activation_check' %}
    => Within the onSendActivationEmail(), there's clearly the check:
            if (!$user = $this->user()) {
                throw new ApplicationException(Lang::get(/*You must be logged in first!*/'rainlab.user::lang.account.login_first'));
            }

Suggestion for Solution:
If the user wants to login and the account is not activated, instead of a message letting him know, he's redirected to a simple form with a button and an email field, where he can type in his adress and the mail is send again.

This is a valid logic trap. At the moment, the user needs to contact an administrator to manually activate the account.

Ok then I'll will make a note for those cases manually.

Do I guess right that this will most likely not be fixed since the Rainlab Users will be deprecated with the next October version?

This plugin is widely used so it won't be deprecated any time soon. There is a new user module for version 4 that canaddress this. Once solved there, we can backport it to this plugin.

We've decided to just upgrade this plugin instead: #526

We'll make sure an adequate workflow is included for this.

This has been reviewed and addressed today in v3 (#526). There are so many different scenarios that it is simpler to address this inside Twig.

The layout can redirect an unverified user to a verification page that lets them verify a second time.

Notes added to the upgrade guide:


Require Activation is Removed

The Require Activation functionality has been removed for simplicity. The replacement approach below is more flexible, since custom pages or banners can be used based on the requirements.

A user can be checked if they are verified using Twig:

{% if not user.hasVerifiedEmail %}
    {% do redirect('account/login') %}
{% endif %}

It is possible to require administration approval by creating an "Approved User" user group, or by extending the users database table with a is_approved field. Then check in Twig:

{% if not user.is_approved %}
    {% do redirect('account/login') %}
{% endif %}