Components

AuthCard

<AuthCard isAuthenticated authStage setLoading showAlert startAuthFlow changeAuthFlow done />

Renders the AuthCard component. Handles both sign in and sign up authentication (username and password).

Constructor

# <AuthCard isAuthenticated authStage setLoading showAlert startAuthFlow changeAuthFlow done />

PropTypes:
Name Type Required Description Default
isAuthenticated bool Yes Indicates if a user is authenticated
authStage enum Yes The current auth stage. See stages.
setLoading func Yes Tells Redux to show/hide the loading HUD (true for show and false for hide (i.e. remove))
showAlert func Yes Tells Redux to show an alert
startAuthFlow func Yes Tells Redux to start the auth flow
changeAuthFlow func Yes Tells Redux to change the auth flow
done func Yes Tells Redux that this component is no longer needed (i.e. done)
Author:

View Source components/AuthCards/AuthCard/AuthCard.js, line 32

Extends

  • Component

Members

# _isMounted

Indicates if the component is mounted. Used for asynchronous tasks.
See:

View Source components/AuthCards/AuthCard/AuthCard.js, line 51

# state

AuthCard component state
Properties:
Name Type Description
formData object Form input values
email string The email input value
password string The password input value

View Source components/AuthCards/AuthCard/AuthCard.js, line 39

Methods

# static mapDispatchToProps(dispatch) → {object}

Passes certain Redux actions to the AuthCard component as props. This function is used only by the react-redux connect function.
Parameters:
Name Type Description
dispatch function The react-redux dispatch function

View Source components/AuthCards/AuthCard/AuthCard.js, line 486

Redux actions used in the AuthCard component
object

# static mapStateToProps(state) → {object}

Gets the current state from Redux and passes parts of it to the AuthCard component as props. This function is used only by the react-redux connect function.
Parameters:
Name Type Description
state object The Redux state

View Source components/AuthCards/AuthCard/AuthCard.js, line 473

Redux state properties used in the AuthCard component
object

# changeAuthFlowIfNeeded(prevProps)

Changes the auth flow if needed
Parameters:
Name Type Description
prevProps object The previous props object

View Source components/AuthCards/AuthCard/AuthCard.js, line 87

# checkIfUserIsAuthenticated()

Checks if a user is authenticated If a user is authenticated, the proper action is taken.

View Source components/AuthCards/AuthCard/AuthCard.js, line 107

# componentDidMount()

Sets _isMounted to true Starts the auth flow

View Source components/AuthCards/AuthCard/AuthCard.js, line 57

# componentDidUpdate()

Checks if a user is authenticated. Changes the auth flow if needed.

View Source components/AuthCards/AuthCard/AuthCard.js, line 70

# componentWillUnmount()

Sets _isMounted to false

View Source components/AuthCards/AuthCard/AuthCard.js, line 78

# getChangeAuthButtonTitle() → {string}

Gets the change auth button's title

View Source components/AuthCards/AuthCard/AuthCard.js, line 353

A title
string

# getHeading() → {string}

Gets the component's heading

View Source components/AuthCards/AuthCard/AuthCard.js, line 331

A heading
string

# getSubmitButtonTitle() → {string}

Gets the form submission button's title

View Source components/AuthCards/AuthCard/AuthCard.js, line 342

A title
string

# isEmailValid() → {boolean}

Checks if the user's email is valid

View Source components/AuthCards/AuthCard/AuthCard.js, line 197

Indicates if the email is valid
boolean

# isPasswordValid() → {boolean}

Checks if the user's password is valid

View Source components/AuthCards/AuthCard/AuthCard.js, line 219

Indicates if the password is valid
boolean

# removeWhitespace(str) → {string}

Removes whitespace from a string
Parameters:
Name Type Description
str string String to transform

View Source components/AuthCards/AuthCard/AuthCard.js, line 264

- A string without whitespace
string

# render()

Renders the AuthCard component

View Source components/AuthCards/AuthCard/AuthCard.js, line 362

# sendEmailVerification()

Sends an email verification to the current user

View Source components/AuthCards/AuthCard/AuthCard.js, line 125

# signInWithEmailPassword()

Signs the user in with an email and password

View Source components/AuthCards/AuthCard/AuthCard.js, line 270

# signUpWithEmailPassword()

Signs the user up with an email and password

View Source components/AuthCards/AuthCard/AuthCard.js, line 300

# submitHandler(event)

Submits the authentication form (sign in or sign up)
Parameters:
Name Type Description
event The event that called this function

View Source components/AuthCards/AuthCard/AuthCard.js, line 173

# textInputValueChangedHandler(event)

Updates state with new text input value
Parameters:
Name Type Description
event The event that called this function

View Source components/AuthCards/AuthCard/AuthCard.js, line 154