Authform Rails
Introduction
Add authentication to your Rails application - in 1 minute or less - with Authform.io.
Installation
Add this line to your Rails application's Gemfile:
gem "authform-rails"
And then execute:
$ bundle install
Usage
Add your form
<form action="https://api.authform.io/v1/f/{FORM_UUID}" method="POST">
<input type="email" name="email">
<button type="submit">Sign In</button>
</form>
Add the Authform::Rails::Concern to your ApplicationController.rb
class ApplicationController < ActionController::Base
include Authform::Rails::Concern.new form_uuid: {FORM_UUID}
before_action :require_login
private
def require_login
unless current_user
flash[:error] = "You must be logged in to access this section"
redirect_to new_login_url # halts request cycle
end
end
end
That's it!
License
The gem is available as open source under the terms of the MIT License.