This repository demonstrates the implementation of email verification in a Ruby on Rails application using a verification code. Email verification is a vital security feature that ensures the authenticity of user accounts
For more in-depth information and best practices on implementing Web Push Notifications in Ruby on Rails, check out our comprehensive article:
Email Verification with Sent Codes in Ruby on Rails: A Step-by-Step Guide
Clone this repository to your local development environment:
- Clone the repository:
git clone https://github.com/DeVuDeveloper/email-verification.git
cd email-verification
- Install the required gems:
bundle install
bin/setup
- Set up the database:
rails db:create
rails db:migrate
rails db:seed
- Run the server(Open your Browser and navigate to url: http://localhost:3000/):
bin/dev
The Email Verification relies on the following main dependencies:
- Ruby on Rails: The web application framework used to build the app.
- Devise: A flexible authentication solution for Rails.
- Stimulus: JavaScript framework used to enhance interactivity on web pages and applications.
- Tailwind CSS: A utility-first CSS framework for styling the app.
The Hotel App includes a linter. You can run the linter with the following command:
rubocop && rubocop -A
npm run lint && npm run lint:fix
The Hotel App includes a test suite using RSpec. You can run the tests with the following command:
rspec spec
This project uses background jobs for efficient email verification:
- SendPinJob: Sends verification codes to users' email addresses.
- UpdateUserJob: Updates the user's verification status.
The VerifyController
manages the email verification process:
- new: Displays the verification code input form.
- create: Sends verification codes to user email addresses.
- edit: Provides a form for entering verification codes.
- update: Validates entered codes and marks emails as verified.
A Stimulus controller improves the user experience by automatically focusing on the next input field after each code digit is entered.