New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-mat-authentication

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-mat-authentication

This is a fully customize authentication library where we can find login, forgot password, reset password, verify otp features

latest
Source
npmnpm
Version
1.2.9
Version published
Maintainers
1
Created
Source

Getting Started

In this libary module will provide a custom, moduler UI authentication given below here:

Features

  • Login Via Password
  • Forgot Password
  • Reset Password
  • Login Via OTP
  • Verify OTP

Example Git Url

Login Featrue

Login feature is working fine now.

Login Props

ILoginViaPasswordProps {
  fieldConfig?: IFeild;
  fieldGutter?: number;
  buttonConfig?: any;
  loader?: boolean;
  subHead?: string;
  onSubmitData?: (data: IFormInputs) => void | undefined;
  redirectToForgotPassword?: () => void | undefined;
  hideForgotPassword?: boolean;
  hideRememberMe?: boolean;
}

Example:

import React, { useState } from "react";
import { useNavigate } from "react-router";
import { LoginViaPassword } from "react-mat-authentication";

const LoginComponent = () => {
  const [loader, setLoader] = useState(false);
  const navigate = useNavigate();

  const redirectToForgotPasswordHandler = () => navigate("/forgot-password");

  return (
    <LoginViaPassword
      fieldConfig={{ variant: "outlined" }}
      loader={loader}
      hideForgotPassword={true}
      hideRememberMe={true}
      onSubmitData={(data: any) => {
        console.log(data);
        setLoader(true);
        setTimeout(() => {
          setLoader(false);
        }, 1000);
      }}
      redirectToForgotPassword={redirectToForgotPasswordHandler}
    />
  );
};

export const Login = LoginComponent;

Forgot Password Feature

Forgot password feature is working fine now.

Forgot Password Props

IForgotPasswordProps {
  type: "mobile" | "email";
  isCode?: boolean;
  fieldConfig?: IFeild;
  buttonConfig?: any;
  loader?: boolean;
  onSubmitData: (data: any) => any;
  redirectToSignIn: () => void | undefined;
}

Example:

import React, { useState } from "react";
import { useNavigate } from "react-router";
import { ForgotPassword } from "react-mat-authentication";

const ForgotPasswordComponent = () => {
  const [loader, setLoader] = useState(false);
  const navigate = useNavigate();
  const redirectToSigninHandler = () => navigate("/login");

  return (
    <div>
      <ForgotPassword
        type="mobile"
        loader={loader}
        onSubmitData={(data: any) => {
          console.log(data);
          setLoader(true);
          setTimeout(() => {
            setLoader(false);
            navigate("/reset-password");
          }, 1000);
        }}
        redirectToSignIn={redirectToSigninHandler}
      />
    </div>
  );
};

export const ForgotPasswordPage = ForgotPasswordComponent;

Reset Password Feature

Reset password feature is working fine now.

Reset Password Props

IResetPasswordProps {
  fieldConfig?: IFeild;
  loader?: boolean;
  buttonConfig?: any;
  onSubmitData: (data: IFormInputs) => void | undefined;
  redirectToSignIn: () => void | undefined;
}

Example:

import React, { useState } from "react";
import { useNavigate } from "react-router";
import { ResetPassword } from "react-mat-authentication";

export default function ResetPasswordPage() {
  const [loader, setLoader] = useState(false);
  const navigate = useNavigate();
  const redirectToSigninHandler = () => navigate("/login");

  return (
    <div>
      <ResetPassword
        loader={loader}
        onSubmitData={(data: any) => {
          console.log(data);
          setLoader(true);
          setTimeout(() => {
            setLoader(false);
            navigate("/reset-password");
          }, 1000);
        }}
        redirectToSignIn={redirectToSigninHandler}
      />
    </div>
  );
}

Verify OTP Feature

Verify OTP feature is working fine now.

Verify OTP Props

IVerifyOTPProps {
  buttonConfig?: any;
  loader?: boolean;
  numInputs?: number;
  otpDuration?: number;
  isInputNum?: boolean;
  subHead?: string;
  onSubmitData: (data: string) => void | undefined;
  resendOTPData: () => void | undefined;
}

Example:

import React from "react";
import { VerifiOTP } from "react-mat-authentication";

export const VerifiOTPScreen = () => {
  const [loader, setLoader] = React.useState(false);

  const resendOtpHandler = () => {};

  const submitHandler = (data: any) => {
    console.log(data);
    setLoader(true);
    setTimeout(() => {
      setLoader(false);
    }, 1000);
  };

  return (
    <div>
      <VerifiOTP
        loader={loader}
        isInputNum={false}
        numInputs={6}
        otpDuration={5}
        resendOTPData={resendOtpHandler}
        onSubmitData={submitHandler}
      />
    </div>
  );
};

Add this CSS

Use this css .otpContainer {
    display: flex;
}

.otpInput {
    width: 100% !important;
    height: 3rem;
    margin: 0 1rem;
    font-size: 2rem;
    text-align: center;
    border: none;
    outline: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
}

.otpInput::-webkit-outer-spin-button,
.otpInput::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

/*  Add breakpoint for iPhone */
@media only screen and (max-width: 375px) {
    .otpInput {
        width: 100% !important;
        height: 1.5rem;
        font-size: 1rem;
        padding: 8px;
    }
}

Keywords

React Login Via Password

FAQs

Package last updated on 11 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts