Skip to content

It is possible to login unconfirmed authenticated users. #10308

@SalahAdDin

Description

@SalahAdDin

Bug report

It is possible to login on Strapi using a unconfirmed unauthenticated user.

Describe the bug

When we login using the API(GraphQL), we can get logged in on session even if we are not confirmed yet when we should not get access to the platform if we are not confirmed.

Steps to reproduce the behavior

  1. Register a user from the API(GraphQL), it will be confirmed by default but updated to be unconfirmed.
  2. Check the user was create on the admin panel.
  3. Do login from the API(GraphQL).
  4. See error: it is logged in, the jwt comes even when the user is not confirmed yet.

Expected behavior

It should not be able to login on Strapi while the user is not confirmed.

Screenshots

image

Code snippets

package.json:

"dependencies": {
    "knex": "0.21.18",
    "sqlite3": "5.0.0",
    "strapi": "3.6.2",
    "strapi-admin": "3.6.2",
    "strapi-connector-bookshelf": "3.6.2",
    "strapi-plugin-content-manager": "3.6.2",
    "strapi-plugin-content-type-builder": "3.6.2",
    "strapi-plugin-email": "3.6.2",
    "strapi-plugin-graphql": "3.6.2",
    "strapi-plugin-i18n": "3.6.2",
    "strapi-plugin-upload": "3.6.2",
    "strapi-plugin-users-permissions": "3.6.2",
    "strapi-provider-email-amazon-ses": "^3.6.2",
    "strapi-provider-upload-aws-s3": "^3.6.2",
    "strapi-utils": "3.6.2"
  },

System

  • Node.js version: v14.16.1
  • NPM version: 6.14.12
  • Strapi version: 3.6.2
  • Database: SQLite
  • Operating system: Deepin 20.2 x86_64

Additional context

Our authentication workflow is the next:

  1. A user does registration through in the application through the API(GraphQL).
  2. This user must be unconfirmed till the admin confirm it.
  3. The admin confirm it.
  4. The user can then login on the plartfom.

To enable this behaviour avoiding to send confirmation emails, we just opted by not enable the confirm email workflow but update the newly create user after its registration (afterCreate lifecycle).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions