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) |
Extends
- Component
Members
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 |
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 |
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 |
# checkIfUserIsAuthenticated()
Checks if a user is authenticated
If a user is authenticated, the proper action is taken.
# componentDidMount()
Sets _isMounted to true
Starts the auth flow
# componentDidUpdate()
Checks if a user is authenticated.
Changes the auth flow if needed.
# componentWillUnmount()
Sets _isMounted to false
# isEmailValid() → {boolean}
Checks if the user's email is valid
Indicates if the email is valid
boolean
# isPasswordValid() → {boolean}
Checks if the user's password is valid
Indicates if the password is valid
boolean
# removeWhitespace(str) → {string}
Removes whitespace from a string
Parameters:
Name | Type | Description |
---|---|---|
str |
string | String to transform |
- A string without whitespace
string
# render()
Renders the AuthCard component
# sendEmailVerification()
Sends an email verification to the current user
# signInWithEmailPassword()
Signs the user in with an email and password
# signUpWithEmailPassword()
Signs the user up with an email and password
# submitHandler(event)
Submits the authentication form (sign in or sign up)
Parameters:
Name | Type | Description |
---|---|---|
event |
The event that called this function |
# textInputValueChangedHandler(event)
Updates state with new text input value
Parameters:
Name | Type | Description |
---|---|---|
event |
The event that called this function |