Views

These are the account app views.

login_view

View to provide the frontend with the necessary information for the login template or to validate a user’s login according to the request method. If the user is logged in to the url indicated in the ACCOUNT_LOGIN_REDIRECT_URL variable.

  • URL: /login.

  • GET: Provide the data to the frontend; these data are:

    • component: “Login”

    • props:

      props = {
      "socialAccount": # Authentication provider information,
      "captchaSettings": # Captcha Provider Information,
      }
    
  • POST: validates the user’s authentication credentials: Email, password and captcha token (if this module is active). If valid, it authenticates and redirects to the url indicated in the settings variable ACCOUNT_LOGIN_REDIRECT_URL. If invalid, the error is added to the general inertia props.

    • The data per POST method has received are:

      {
      "email": # Email user,
      "password": # Password user,
      "captcha": # Captcha token (may be blank if Captcha module is not active)
      }
    

logout_view

View to logout the user.

  • URL: /logout.

  • GET: Closes the user’s session and redirects to the url indicated in the ACCOUNT_LOGOUT_REDIRECT_URL variable.

register_view

View to provide the frontend with the necessary information for the registration template and/or validate the user registration.

  • URL: /register.

  • GET: Provide the data to the frontend; these data are:

    • component: “Register”

    • props:

      props = {
        "paramsPasswordValidator": # Parameters for password validation,
        "socialAccount": # Authentication provider information,
        "captchaSettings": # Captcha Provider Information,
      }
    
  • POST: Validates the credentials for user registration: First name, Last name, email, password and captcha token (if this module is active). If valid, the user is registered and redirected to the url indicated in the settings variable ACCOUNT_SIGNIN_REDIRECT_URL. If invalid, the error is added to the general inertia props.

    • The data per POST method has received are:

    {
      "firstName": # First Name user,
      "lastName": # Last name user,
      "email": # Email user,
      "password": # Password user,
      "captcha": # Captcha token (may be blank if Captcha module is not active)
    }
    

email_verification_send

View that tells the frontend which component to render and/or sends the confirmation email to the user.

  • URL: /email-verification-sent

  • GET: Provides the frontend with the information to render:

    • component: “EmailVerificationSend”

    • props: No data.

  • POST: Validates that the indicated email is registered in the app, as well as the waiting time for the confirmation email to be resent. If it is correct, it sends the email to the indicated email address and is redirected to /login; otherwise the error is added to the general inertia props.

    • The data per POST method has received are:

    {
      "email": # Email user
    }
    

confirm_email

View to confirm the user’s email address. Receives a random string (generated in the email_verification_sent view) with the name key that allows the user to be validated. If it is valid, it redirects to the EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL. If the key is wrong or has expired, the ConfirmEmail frontend component is rendered.

  • URL: /confirm-email/

password_reset

list that tells the frontend which component to render and/or sends the email with the url and token to change the password.

  • URL: /password/reset

  • GET: Provides the frontend with the information to render:

    • component: “PasswordReset”

    • props: No data.

  • POST: Validates that the indicated email is registered in the app; if correct, it sends the email to the indicated email address and is redirected to /login; otherwise the error is added to the general inertia props.

password_reset_from_key

View that renders the component that allows the user to change their password. It receives two random strings (generated in the password_reset view) of names uidb36 and key per url, which allow to validate the user and create a session.

  • URL: /password/reset/key/-

  • GET: Validate the uidb36 and the key, if they are valid, render the component with the form to change the password, with the following data:

    • component: “SetPasswordFromKey”

    • props:

     props = {
       "uidb36": # user ID,
       "keyToken": # Token to validate the sent email,
       "tokenInvalid": # Boolean field indicating whether the token is valid or not,
       "paramsPasswordValidator": # Parameters for password validation,
     }
    
  • POST: Validate the uidb36 and the key, if valid, check that the new password complies with the established parameters. If correct, change the password, otherwise the error is added to the general inertia props.

    • The data to receive are:

    {
      "password": # The new password
    }
    

change_password

View to change the password of a logged in user (requires to be logged in). In this view, the component for the password change request is rendered or an email is sent with the url to complete the password change. The password change url redirects to the password_reset_from_key view

  • URL: /settings/change/password

  • GET: Provides the frontend with the information to render:

    • component: “ChangePassword”

    • props: No data.

  • POST: Send the email to the user’s email address with the url to complete the password change.

resent_email_verification_api

View with ajax access to resend the confirmation email to the user’s email address (requires being logged in). Looks up the user’s non-primary email address and checks if it can be sent by checking the wait period for mail forwarding. If correct, the email is sent with the url to confirm the user’s email address; Otherwise, it returns a JsonResponse indicating the time it must wait to be able to resend the email.

  • URL: /resend-email-verification

  • GET: Receives a request to send a confirmation email to the user’s email address.

google_login

View that receives the information from Google when used as a user authenticator. It is the view configured as callback to receive the authentication code or error. If there is no error and the code is correct, the user’s information is requested to create the record in case the user does not exist. If the user exists, it is logged in. And redirects to the login view

  • URL: /google/login/callback