Skip to content

UserAuth is a class that handles form submission in the client side.

Notifications You must be signed in to change notification settings

Jtzuya/UserAuth-Class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

UserAuth Class

The UserAuth class handles user authentication actions such as sign-in, sign-out, sign-up, and OTP submission. It can also be extended or modified for simple form submissions.

Installation

  1. Clone the repository or download the file containing the UserAuth class.
  2. Include the script in your project.

Usage

To use the UserAuth class, create an instance of the class by providing the authentication method and the form element's identifier.

import UserAuth from './path-to-file/UserAuth.js';
const auth = new UserAuth('signin', 'loginForm');

Methods

constructor(method, elementIdentifier)

Creates an instance of UserAuth.

  • method: The authentication method (e.g., 'signin', 'signout', 'signup', 'otp_submit', 'otp_resend').
  • elementIdentifier: The ID of the form element to bind event listeners to.

Example

<form id="loginForm" action="/login">
  <input type="email" name="email" required>
  <input type="password" name="password" required>
  <button type="submit">Sign In</button>
  <div class="error"></div>
</form>

<script type="module">
  import UserAuth from './path-to-file/UserAuth.js';
  const auth = new UserAuth('signin', 'loginForm');
</script>

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

UserAuth is a class that handles form submission in the client side.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages