No release in over a year
Authentication for Ruby on Jets apps
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 3.1
 Project Readme

ReviseAuth

A pure Ruby on Jets authentication system like Devise.

Screenshots

Admin View Screenshot 2023-09-26 at 8 51 56 PM

Login / Sign Up Screenshot 2023-09-26 at 8 52 27 PM

Edit Profile Screenshot 2023-09-26 at 8 53 25 PM

Test Auth Route Screenshot 2023-09-26 at 8 53 03 PM

Installation

Add this line to your application's Gemfile:

bundle add "revise_auth-jets"

And then execute the following to generate a User model (optionally adding other fields such as first_name and last_name):

$ jets g revise_auth:model User
$ jets db:migrate
$ jets g revise_auth:views

Add

require "active_record"
ActiveRecord::Base.signed_id_verifier_secret = "custom_verfifier_secret"

in your initializers. Set this as an env var

Create your app/mailer/application_mailer.rb

class ApplicationMailer < ActionMailer::Base
  default from: 'YOUR_EMAIL@gmail.com'
  layout 'mailer'
end

Add your stmp settings in your development.rb ex:

  config.action_mailer.default_url_options = { host: 'localhost', port: 3000, protocol: "https" }
  config.action_mailer.perform_deliveries = true
  config.action_mailer.show_previews = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    address:              'smtp.gmail.com',
    port:                 587,
    domain:               'gmail.com',
    user_name:            'USERNAME@gmail.com',
    password:             'YOUR_PASS',
    authentication:       'plain'}

To get your stmp pass follow these steps

You need to make a password for specific app

Step one: enable 2FA

https://myaccount.google.com/signinoptions/two-step-verification/enroll-welcome Step two: create an app-specific password

https://myaccount.google.com/apppasswords

Usage

ReviseAuth is designed around a single User model.

What you get

Sleek login, sign in, and edit profile screen Screenshot 2023-09-22 at 11 58 42 AM

Api capabilities with sample route api/v1/me Screenshot 2023-09-22 at 11 59 53 AM

Roles / Other User Types

ReviseAuth only works with a single model to keep things simple. We recommend adding roles to handle other types of users.

You can accomplish this in a few different ways:

  • A roles attribute on the User model
  • The Rolify gem