GithubHelp home page GithubHelp logo

account's Introduction

Account

Short description and motivation.

Installation

Add this line to your application's Gemfile:

gem 'account'

Usage

  1. copy template/devise.rb to your application: admin_engine/config/initializer/devise.rb || config/initializer/devise.rb.

  2. Add account gem routes to your app/config/routes.rb.

mount Account::Engine   => '/', as: 'account'

Add admin_root or user_root in app/config/routes.rb, for redirection after login. eg:

  get '/manager/conferences', to: 'admin/manager/conferences#index', :as => :admin_root
  1. for wechat omniauth copy template/omniauth.rb to your application: config/initializer/omniauth.rb.

  2. copy db/migrate to your application.

$ rails db:migrate
  1. add before_action :authenticate_manager, to your ApplicationController
def authenticate_manager
  unless admin_signed_in? && (current_admin.role == "admin")
    sign_out :admin
    redirect_to account.new_admin_session_path, notice: "请使用admin账户访问该页面"
  end
end

Info

phone_verification use fetch, not support IE.

Config

Create config/initializers/account_engine.rb and put following configurations into it. I like to put it at admin engine.

# eg.
Account::Engine.custom_routes = true
Account::Engine.admin_modle_devise_setting = [:database_authenticatable]

If you setting custom_routes = ture, then add following to your routes file. I like to put it at admin engine routes file.

Account::Engine.routes.draw do
  devise_for :admins, module: 'devise', class_name: "Account::Admin", only: :sessions
end

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.

account

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.