Nyauth
application_controller.rb
class ApplicationController < ActionController::Base
include Nyauth::SessionConcern
end
migration
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :email, null: false
t.string :password_digest, null: false
t.string :password_salt, null: false
t.string :nickname
t.datetime :confirmed_at
t.string :confirmation_key
t.datetime :confirmation_key_expired_at
t.string :reset_password_key
t.datetime :reset_password_key_expired_at
t.timestamps null: false
end
add_index :users, :email, unique: true
end
end
model
class User < ActiveRecord::Base
include Nyauth::Authenticatable
include Nyauth::Confirmable
include Nyauth::ResetPasswordAbility
end
config/routes.rb
Rails.application.routes.draw do
namespace :nyauth, path: :admin, as: :admin do
resource :session, only: i(new create destory)
end
mount Nyauth::Engine => "/"
end
rake routes
Prefix Verb URI Pattern Controller
nyauth /nyauth Nyauth::Engine
Routes for Nyauth::Engine:
registration POST /registration(.:format) nyauth/registrations
new_registration GET /registration/new(.:format) nyauth/registrations
session POST /session(.:format) nyauth/sessions
new_session GET /session/new(.:format) nyauth/sessions
DELETE /session(.:format) nyauth/sessions
edit_password GET /password/edit(.:format) nyauth/passwords
password PATCH /password(.:format) nyauth/passwords
PUT /password(.:format) nyauth/passwords
confirmation_requests POST /confirmation_requests(.:format) nyauth/confirmation_requests
new_confirmation_request GET /confirmation_requests/new(.:format) nyauth/confirmation_requests
confirmation GET /confirmations/:confirmation_key(.:format) nyauth/confirmations
reset_password_requests POST /reset_password_requests(.:format) nyauth/reset_password_requests
new_reset_password_request GET /reset_password_requests/new(.:format) nyauth/reset_password_requests
edit_reset_password GET /reset_passwords/:reset_password_key/edit(.:format) nyauth/reset_passwords
reset_password PATCH /reset_passwords/:reset_password_key(.:format) nyauth/reset_passwords
PUT /reset_passwords/:reset_password_key(.:format) nyauth/reset_passwords
new_session_path_for(:user)
new_session_path_for(:admin)