Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Manage users and admins with Devise and Omniauth-Facebook.
Ruby CSS JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
config
db
lib
script
test
.gitignore
Gemfile
MIT-LICENSE
README.rdoc
Rakefile
simple_user.gemspec

README.rdoc

SimpleUser

Manage users and admins with Devise and Omniauth-Facebook.

Make avaiable to your users for loggin with Devise or Facebook, and manage them and your admins. Each admin is related to roles with Rolify, and manages authorization with CanCan.

Installation

  1. Add to your gemfile: gem 'simple_user'

  2. Run bundle

  3. Execute: rails generate simple_user:install

  4. Run migrations: rake db:migrate

  5. Run seeds: rake db:seed

  6. Add to your routes.rb: mount SimpleUser::Engine => "/simple_user", :as => "simple_user"

  7. Add to your application.js: //= require simple_user/application

  8. Add before filters banned? and set_user_return_to (check /lib/simple_user/concerns/controllers/application_controller.rb if you want to override these methods)

  9. Watch the test/dummy for an example of the links

  10. Remember add config.action_mailer.default_url_options = { :host => 'localhost:3000' } to your config/application.rb, and change the host in production

Link your views

Example for users:

<% unless user_signed_in? %>
	<%=link_to "Login", simple_user.new_user_session_path %>
	<%= link_to "Login with Facebook", "/simple_user/auth/facebook", id: "sign_in" %>
<% else %>
	<%= link_to "Welcome, #{current_user.username}", simple_user.edit_user_registration_path %>
	<%= link_to "Log out", simple_user.destroy_user_session_path, method: :delete, id: "sign_out" %>
<% end %>

Example for admins:

<% unless admin_user_signed_in? %>
	<%=link_to "Login", simple_user.new_admin_user_session_path %>
<% else %>
	<%= link_to "Welcome, Admin: #{current_admin_user.username}", simple_user.edit_admin_user_registration_path %>
	<% if can? :manage, SimpleUser::AdminUser %>
		<%= link_to "Manage Admins", simple_user.admin_users_path %>
	<% end %>
	<% if can? :manage, SimpleUser::User %>
		<%= link_to "Manage Users", simple_user.users_path %>
	<% end %>
	<%= link_to "Log out", simple_user.destroy_admin_user_session_path, method: :delete, id: "sign_out" %>
<% end %>

TODO

  1. Integrate Twitter

  2. Ingrate Google

  3. Remove unnecessary files and codes (rake task, omniauth, …)

Something went wrong with that request. Please try again.