---
name: Auth
description: Let's users log in, log out, reset password, and kick people out of the app if not logged in
user_stories:
  - As a user, i want to be able to login to my app so that I can access my campaign
  - As a user, I want to be able to log out when I'm done
  - As a user, I want to be able to safely reset my password so that I still have access if I have forgotten my credentials
  - As a user, if my account validation fails during log in, don't let me through
  - As a user, I want to remain logged in indefinitely, until I log out to save me from logging in all the time
  - As a developer, I want a simple way to establish what pages are private vs public
  - As a stakeholder, I want to show users messages/notifications before they log in and after logging out
  - As a user, when I log in, I want to be dynamically routed to the appropriate destination based on my account status
screens: "https://content.screencast.com/users/KyleGraham/folders/Jing/media/3b4ba161-5221-4cae-9129-1c3457984040/00000002.png"
workflow: ""
test_plan:
  - scenario: Submits correct credentials
    expected: Successfully routed to dashboard
    automated: "Yes"
  - scenario: Submits incorrect credentials
    expected: Error message is displayed
    automated: "Yes"
  - scenario: Forgets their password
    expected: Error message is displayed
    automated: "Yes"
  - scenario: Clicks (in email) to reset their password
    expected: New page with email text field & reset button. If clicked it emails the user a secure reset link/token that expires in 30 minutes
    automated: "Yes"
  - scenario: Changes their password
    expected: Checks if > 30m.  If it is, show "expired" message.  If not, show password, confirm password, & submit form button
    automated: "Yes"
  - scenario: Types in an invalid password
    expected: Repeat 30m check.  If passes, update in db & route to login page with a success message
    automated: "Yes"
  - scenario: Clicks [Log out] button
    expected: If password entered doesn't meet criteria, show failed message and disable submit button until passes
    automated: "Yes"
  - scenario: Revisits after Logging in
    expected: Removes all user tokens/cookies & routes user to new pae with \"thank you for visiting\" message
    automated: "Yes"
  - scenario: Clicks [back to login] link
    expected: Allowed entry without forcing them to re-login
    automated: "Yes"
  - scenario: Multiple failed log in attempts
    expected: Routes user back to login page
    automated: "Yes"
components:
  - name: LoginContainer
    type: Containers
    description: A page using the <AuthLayout /> to show login features
      Uses AuthLayout to show an ad from the db & login features.  Also triggers a verification script on login
      Shows an ad on the left and auth stuff on the right
      Can show an ad and auth block on right
    behaviors: ""
    exists: "No"
    package: "No"
    schema:
      - name: children
        type: JSX.Element
        description: Component to use - will override default layouts if provided
        schema_type: prop
        required: false
      - name: adComponent
        type: JSX.Element
        description: Takes a component as an input that shows an ad (usually <Announcement />)
        schema_type: prop
        required: false
      - name: authComponent
        type: JSX.Element
        description: Container to use for the login screen (e.g. "Name/Email/Continue/forgot"
        schema_type: prop
        required: false
      - name: onVerify
        type: "(email: string, password: string) => boolean"
        description: Handler that is called when the "handleVerification" render prop from the authComponent is triggered
        required: true
        schema_type: prop
      - name: onAdClick
        type: "(id: string, url: string) => void"
        description: Handler that is called when the "handleAdClick" render prop from the adComponent component is triggered
        required: false
        schema_type: prop
      - name: onForgotPassword
        type: "() => void"
        description: Handler that is called when the handleForgotPassword render prop from the authComponent is triggered
        required: false
        schema_type: prop
      - name: onValidate
        type: "(email: string, password: string): boolean"
        description: Handler that is called when the handleValidation render prop is triggered from the authComponent prop
        required: false
        schema_type: prop
    tests:
      - it: Events - Should render in the dom
        type: Integration
      - it: Rendering - Should call the appropriate API when the handleVerify method is called
        type: Integration
      - it: Rendering - Should navigate to the 'forgot password' page when the handleForgotPassword method is called
        type: Integration
      - it: Rendering - Should call the appropriate API when the handleValidate method is called
        type: Integration
database: []
api: []
