Skip to content

Email activation, login and reset password. #682

Description

@jtraulle

This is a :

  • enhancement
  • feature-discussion (RFC)

If I am not wrong, the same token field is used in database to validate the user email address when using Users.Email.validate and when the user request to reset password.

So, if a user :

  • register through the app but does not validate his/her email
  • try to login directly through the app (Flash message indicates that "Username or password is incorrect" as there is no specific message for an existing user with correct password but inactive account — as the check for both username, password AND active fields seems to be done in the same query)
    ->find('active', $options);

    public function findActive(Query $query, array $options = [])
    {
    $query->where([$this->_table->aliasField('active') => 1]);
    return $query;
    }
  • as the app says "Username or password is incorrect", the user think that he/she mistyped the password and request to reset the password
  • doing so, the token field which previously contained the token used to validate the user's email address is overridden by the token used to reset the password
  • the user successfully reset its password but he/she still cannot login because his/her account is still inactive

In my opinion, when a user logs in, the plugin should first check if username and password are correct, then, if user is not activated, display a specific error message.

  • if the token is still valid, output a Flash message to tell the user to click the link on the email ; else resend a new activation email and tell the user to click the link

On the other hand, if the user request to reset its password and his/her account is not active, then, the plugin should :

  • prevent the user to reset his/her password by telling that it is not possible as he/she muste activate his/her account first
  • if the token is still valid, output a Flash message to tell the user to click the link on the email ; else resend a new activation email and tell the user to click the link

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions