No commit activity in last 3 years
No release in over 3 years
The email equivalent of has_secure_password for ActiveRecord.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.12.0
~> 13.0.0
~> 3.9.0
~> 0.18.0
~> 0.9.0

Runtime

>= 5.0.0
 Project Readme

Has Email Authentication

Gem Version Code Climate Test Status

HasEmailAuthentication, for Rails/ActiveRecord 5.0+, is a micro library that compliments has_secure_password by providing has_email_authentication.

This library was developed for- and extracted from HireFire.

The documentation can be found on RubyDoc.

Compatibility

  • Rails/ActiveRecord 5.0+
  • Ruby (MRI) 2.5+

Installation

Add the gem to your Gemfile and run bundle.

gem "has_email_authentication"

Example

This library requires you to have an email column in the table associated with the model you're using.

class User < ActiveRecord::Base
  has_email_authentication
end

This does a few things:

  • Adds presence, format and uniqueness validations on email
  • Downcases email before saving the record
  • Provides a User.find_by_email(params[:email]) convenience method which downcases the provided email

Contributing

Contributions are welcome, but please conform to these requirements:

  • Ruby (MRI) 2.5+
  • ActiveRecord 5.0+
  • 100% Spec Coverage
    • Generated by when running the test suite
  • 100% Passing Specs
    • Run test suite with $ rspec spec
  • 4.0 Code Climate Score
    • Run $ rubycritic lib to generate the score locally and receive tips
    • No code smells
    • No duplication

To start contributing, fork the project, clone it, and install the development dependencies:

git clone git@github.com:USERNAME/has_email_authentication.git
cd has_email_authentication
bundle

Ensure that everything works:

rspec spec
rubycritic lib

To run the local documentation server:

yard server --reload

Create a new branch and start hacking:

git checkout -b my-contributions

Submit a pull request.

Author / License

Copyright (c) Michael van Rooijen ( @mrrooijen )
Released under the MIT License.