hashes and stores a password in the database to validate the authenticity of a user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication. registerable handles signing up users through a registration process, also allowing them to edit and destroy their account. recoverable resets the user password and sends reset instructions. rememberable resets the user password and sends reset instructions. trackable tracks sign in count, timestamps and IP address. validatable provides validations of email and password. It's optional and can be customized, so you're able to define your own validations. confirmable sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in. lockable locks an account after a specified number of failed sign-in attempts. Can unlock via email or after a specified time period. timeoutable expires sessions that have not been active in a specified period of time. omniauthable adds OmniAuth (https://github.com/omniauth/omniauth) support.
module Models def devise(*modules) options = modules.extract_options!.dup selected_modules = modules.map(&:to_sym).uniq.sort_by do |s| Devise::ALL.index(s) || -1 # follow Devise::ALL order end devise_modules_hook! do include Devise::Models::Authenticatable selected_modules.each do |m| mod = Devise::Models.const_get(m.to_s.classify) if mod.const_defined?("ClassMethods") class_mod = mod.const_get("ClassMethods") extend class_mod if class_mod.respond_to?(:available_configs) available_configs = class_mod.available_configs available_configs.each do |config| next unless options.key?(config) send(:"#{config}=", options.delete(config)) end end end include mod end self.devise_modules |= selected_modules options.each { |key, value| send(:"#{key}=", value) } end end end end
routes (git)-[e346m/fb-auth]- Prefix Verb URI Pattern Controller#Action root GET / home#index new_api_v1_user_session GET /api/v1/auth/sign_in(.:format) api/v1/auth/sessions#new api_v1_user_session POST /api/v1/auth/sign_in(.:format) api/v1/auth/sessions#create destroy_api_v1_user_session DELETE /api/v1/auth/sign_out(.:format) api/v1/auth/sessions#destroy new_api_v1_user_password GET /api/v1/auth/password/new(.:format) devise_token_auth/passwords#new edit_api_v1_user_password GET /api/v1/auth/password/edit(.:format) devise_token_auth/passwords#edit api_v1_user_password PATCH /api/v1/auth/password(.:format) devise_token_auth/passwords#update PUT /api/v1/auth/password(.:format) devise_token_auth/passwords#update POST /api/v1/auth/password(.:format) devise_token_auth/passwords#create cancel_api_v1_user_registration GET /api/v1/auth/cancel(.:format) api/v1/auth/registrations#cancel new_api_v1_user_registration GET /api/v1/auth/sign_up(.:format) api/v1/auth/registrations#new edit_api_v1_user_registration GET /api/v1/auth/edit(.:format) api/v1/auth/registrations#edit api_v1_user_registration PATCH /api/v1/auth(.:format) api/v1/auth/registrations#update PUT /api/v1/auth(.:format) api/v1/auth/registrations#update DELETE /api/v1/auth(.:format) api/v1/auth/registrations#destroy POST /api/v1/auth(.:format) api/v1/auth/registrations#create api_v1_auth_validate_token GET /api/v1/auth/validate_token(.:format) devise_token_auth/token_validations#validate_token api_v1_auth_failure GET /api/v1/auth/failure(.:format) api/v1/auth/omniauth_callbacks#omniauth_failure GET /api/v1/auth/:provider/callback(.:format) api/v1/auth/omniauth_callbacks#omniauth_success GET|POST /api/v1/auth/omniauth/:provider/callback(.:format) api/v1/auth/omniauth_callbacks#redirect_callbacks api_v1_auth_omniauth_failure GET|POST /api/v1/auth/omniauth/failure(.:format) api/v1/auth/omniauth_callbacks#omniauth_failure GET /api/v1/auth/:provider(.:format) redirect(301) api_v1_users GET /api/v1/users(.:format) api/v1/users#index api_v1_user GET /api/v1/users/:id(.:format) api/v1/users#show
Api::V1::Auth::RegistrationsController < DeviseTokenAuth::RegistrationsController before_action :authenticate_user!, except: :create def create super do |resource| #RedisʹtokenಥͬࠐΉΑ͏ͳॲཧͱ͔ͱ͔ End end end