1.0.0 • Published 3 years ago

reactjs-volkeno-authify v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

reactjs-volkeno-authify

Volkeno authentication gives you the possibility of integrating the classic authentication system in a few clicks, while making it easier for you to adapt the forms provided, to each of your React JS projects.

NPM JavaScript Style Guide

Install

npm install --save reactjs-volkeno-authify

Below you will find the documentation to handle the login form so as to modify the style, the text as well as the icon.

What should be remembered is that everything is easily customizable in this library. You will find all the necessary props to adapt this form to your design.

Login Usage

First step: Import the component with css file:

import { AuthLogin } from 'reactjs-volkeno-authify';
import 'reactjs-volkeno-authify/dist/index.css';

Second step: Use the connection component to have the login form

const App = () => {
  return (
    <AuthLogin
      emailName={ 'email' }
      passwordName={ 'password' }
      setApiBase={'http://127.0.0.1/api/'}
      setEndpoint={'login/'}
      keyToken={ 'tokenName' }
      onSuccessLogin={ onSuccessLogin }
      onFailLogin={ onFailLogin }
    />
  )
}

export default App

Registration Usage

First step: Import the component:

import { AuthRegister } from 'reactjs-volkeno-authify';

Second step: Use the registration component to have the register form

const App = () => {
  return (
    <AuthRegister 
      setApiBase={'http://127.0.0.1/api/'}
      setEndpoint={'register/'}
      onSuccessRegister={ onSuccessRegister }
      onFailRegister={ onFailRegister }
      useLogo
      usePhone
      useAddress
    />
  )
}

export default App

Using password recovery

First step: Import the component:

import { AuthRequestResetPassword } from 'reactjs-volkeno-authify';

Second step: Use The password recovery component to get the affected form.

const App = () => {
  return (
    <AuthRequestResetPassword
      setApiBase={'http://127.0.0.1/api/'}
      setEndpoint={'requestResetPassword/'}
      onSuccessRequestPassword={ onSuccessRequestPassword }
      onFailRequestPassword={ onFailRequestPassword }
      emailName={ 'email' }
    />
  )
}

export default App

Using Reset Password

First step: Import the component:

import { AuthResetPassword } from 'reactjs-volkeno-authify'

Second step: Use The reset password component to get the affected form.

const App = () => {
  return (
    <AuthResetPassword
      setApiBase={'http://127.0.0.1/api/'}
      setEndpoint={'changePassword/'}
      onSuccessResetPassword={ onSuccessResetPassword }
      onFailResetPassword={ onFailResetPassword }
      passwordName={ 'password' }
      confirmPasswordName={ 'password_confirm' }
    />
  )
}

export default App

Configuration - Props

Props require

PropertyTypeDefaultDescription
useLogobooleantrueActivate the logo on the form.
useFullNamebooleantrueUse the fullname field instead of the first name and last name fields
usePhonebooleantrueUse the phone field (only in the registration form)
useAddressbooleantrueUse the address field (only in the registration form)
useResetCodebooleantrueUse a code field instead of using password validation (only in the password reset form)
logoFormSrcstring-Use this parameter to enter the url of the logo to display.
firstnameNamestring-Use this parameter to enter the name of the firstnameName input
lastnameNamestring-Use this parameter to enter the name of the lastnameName input
fullnameNamestring-Use this parameter to enter the name of the fullnameName input
phoneNamestring-Use this parameter to enter the name of the phoneName input
addressNamestring-Use this parameter to enter the name of the addressName input
emailNamestring-Use this parameter to enter the name of the email input.
passwordNamestring-Use this parameter to enter the name of the password input.
confirmPasswordNamestring-Use this parameter to enter the name of the confirmPasswordName input.
resetCodeNamestring-Use this parameter to enter the name of the resetCodeName input.
setApiBaseurl-Use this parameter to enter the basic API of the application.
setEndpointurl-Use this parameter to enter the endpoint of the relevant request.
onSuccessRegisterfunctionvoidUse this method to do the actions if the register is successful.
onFailRegisterfunctionvoidUse this method to do the actions if the register failed.
onSuccessLoginfunctionvoidUse this method to do the actions if the connection is successful.
onFailLoginfunctionvoidUse this method to do the actions if the connection failed.
onSuccessRequestPasswordfunctionvoidUse this method to do the actions if the request password is successful.
onFailRequestPasswordfunctionvoidUse this method to do the actions if the request password failed.
onSuccessResetPasswordfunctionvoidUse this method to do the actions if the reset password is successful.
onFailResetPasswordfunctionvoidUse this method to do the actions if the reset password failed.
toastSuccessTextstring-Enter here the message of the connection success alert.
toastErrorTextstring-Enter here the message of the connection failure alert.
keyTokenstring-enter the name of the token that will be stored in the sessionStorage. the default name is (userToken).

To change texts and icons

Find Feather Icons here https://feathericons.com/

PropertyTypeDefaultDescription
titleTextLabelstring-Change the title of the form.
resetPwdTextLabelstring-Change the forgotten password label.
resetPwdUrlstring-The css class of the forgotten password label.
btnPrimaryTextLabelstring-Change the text of the submit button.
btnPrimaryProgressTextLabelstring-Change the text of the submit button in progress.
footerTextLabelstring-Change the text of the footer of the form.
footerLinkTextLabelstring-Change the text of the form footer link.
footerLinkUrlurl/To fill in the redirection url of the link at the bottom of the form.
fullNamePlaceholderstring-Change the text of the fullname placeholder.
iconfullNamePlaceholderstring-Change the icon of the fullname input.
firstNamePlaceholderstring-Change the text of the first name placeholder.
iconFirstNamePlaceholderstring-Change the icon of the first name input.
lastNamePlaceholderstring-Change the text of the last name placeholder.
iconLastNamePlaceholderstring-Change the icon of the last name input.
addressPlaceholderstring-Change the text of the address placeholder.
iconAddressPlaceholderstring-Change the icon of the address input.
phonePlaceholderstring-Change the text of the phone placeholder.
iconPhonePlaceholderstring-Change the icon of the phone input.
mailPlaceholderstring-Change the text of the email placeholder.
iconMailPlaceholderstring-Change the icon of the email input.
passwordPlaceholderstring-Change the text of the password placeholder.
iconPasswordPlaceholderstring-Change the icon of the password input.
confirmPasswordPlaceholderstring-Change the text of the confirm password placeholder.
iconConfirmPasswordPlaceholderstring-Change the icon of the confirm password input.
resetCodePlaceholderstring-Change the text of the reset code placeholder.
iconResetCodePlaceholderstring-Change the icon of the reset code input.
emailRequiredTextErrorstring-Change the error message to the required email.
emailValidTextErrorstring-Change the error message to the validation email
passwordRequiredTextErrorstring-Change the error message to the required password.
confirmPasswordRequiredTextErrorstring-Change the error message to the required confirm password
confirmPasswordSameTextErrorstring-Change the password validation error message
fullnameRequiredTextErrorstring-Change the error message to the required fullname
fullnameValidTextErrorstring-Change the error message to the validation fullname
firstnameRequiredTextErrorstring-Change the error message to the required first name
firstnameValidTextErrorstring-Change the error message to the validation first name
lastnameRequiredTextErrorstring-Change the error message to the required last name
lastnameValidTextErrorstring-Change the error message to the validation last name
phoneRequiredTextErrorstring-Change the error message to the required phone
addressRequiredTextErrorstring-Change the error message to the required address
resetCodeRequiredTextErrorstring-Change the error message to the required reset code

Customize the style of the form and its components

PropertyTypeDefaultDescription
formContainerClassNamestring-Customize the form container.
formClassNamestring-Customize the form.
logoFormClassNamestring-Change logo properties.
titleFormClassNamestring-Change title properties.
inputFormClassNamestring-Customize email and password inputs.
iconInputFormClassNamestring-Customize email and password icons.
btnPrimaryFormClassNamestring-Change login button properties.
footerTextFormClassNamestring-Change the properties of the text at the bottom of the form.
footerLinkFormClassNamestring-Change the properties of the link at the bottom of the form.
toastTextClassNamestring-Stylize the text of the toast.

License

MIT © volkeno-dev