0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Manages generating and clearing a token for remembering the user from a saved cookie.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 3.2
 Project Readme

RememberMe

Gem Version Build Status Dependency Status Code Climate Coverage Status

RememberMe is a simple remember-me login solution on Rails. Manages generating and clearing a token for remembering the user from a saved cookie.

remember me

Installation

Add this line to your application's Gemfile:

gem 'remember_me'

And then execute:

$ bundle

Or install it yourself as:

$ gem install remember_me

Usage

controllers/application_controller.rb:

class ApplicationController < ActionController::Base
  include RememberMe::Controller
end

models/user.rb:

class User < ActiveRecord::Base
  include RememberMe::Model
end

if mongoid

class User
  include Mongoid::Document
  include RememberMe::Model
end

controllers/sessions_controller.rb:

class SessionsController < ApplicationController
  def create
    # ... authenticated ...

    self.current_user = @user
    remember_me(current_user) if remember_me?

    redirect_to root_path, notice: 'Success'
  end

  def destroy
    forget_me(current_user)
    self.current_user = nil
    redirect_to login_path, notice: 'Success'
  end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Author

License

MIT