mix-auth 0.4.0 → 1.0.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/README.rdoc +1 -1
  2. data/app/assets/javascripts/mix-auth/application.js +15 -0
  3. data/app/assets/stylesheets/mix-auth/application.css +13 -0
  4. data/app/controllers/mix-auth/application_controller.rb +4 -0
  5. data/app/controllers/mix-auth/sessions_controller.rb +7 -0
  6. data/app/helpers/mix-auth/application_helper.rb +4 -0
  7. data/app/models/mix-auth/user.rb +45 -0
  8. data/app/views/layouts/auth/application.html.erb +15 -0
  9. data/app/views/users/confirmations/new.html.erb +12 -0
  10. data/app/views/users/mailer/confirmation_instructions.html.erb +5 -0
  11. data/app/views/users/mailer/reset_password_instructions.html.erb +8 -0
  12. data/app/views/users/mailer/unlock_instructions.html.erb +7 -0
  13. data/app/views/users/passwords/edit.html.erb +16 -0
  14. data/app/views/users/passwords/new.html.erb +12 -0
  15. data/app/views/users/registrations/edit.html.erb +25 -0
  16. data/app/views/users/registrations/new.html.erb +18 -0
  17. data/app/views/users/sessions/new.html.erb +17 -0
  18. data/app/views/users/shared/_links.erb +25 -0
  19. data/app/views/users/unlocks/new.html.erb +12 -0
  20. data/config/initializers/devise.rb +11 -4
  21. data/config/initializers/locales.rb +1 -0
  22. data/config/locales/auth.pt-BR.yml +1 -12
  23. data/config/routes.rb +3 -9
  24. data/lib/mix-auth/engine.rb +5 -0
  25. data/lib/mix-auth/version.rb +3 -0
  26. data/lib/mix-auth.rb +7 -1
  27. data/lib/tasks/{auth_tasks.rake → mix-auth_tasks.rake} +0 -0
  28. metadata +35 -81
  29. data/app/assets/javascripts/admix/users.js +0 -2
  30. data/app/assets/stylesheets/admix/users.css +0 -4
  31. data/app/controllers/admix/users_controller.rb +0 -8
  32. data/app/helpers/admix/users_helper.rb +0 -5
  33. data/app/models/ability.rb +0 -28
  34. data/app/models/admix/users_datagrid.rb +0 -17
  35. data/app/models/user.rb +0 -68
  36. data/app/views/admix/users/_form_fields.html.haml +0 -7
  37. data/app/views/admix/users/_show.html.haml +0 -7
  38. data/app/views/admix/users/_table_actions.html.haml +0 -4
  39. data/config/locales/auth.en.yml +0 -17
  40. data/lib/auth/engine.rb +0 -19
  41. data/lib/auth/version.rb +0 -3
  42. data/lib/auth.rb +0 -5
data/README.rdoc CHANGED
@@ -1,3 +1,3 @@
1
- = Auth
1
+ = MixAuth
2
2
 
3
3
  This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ module MixAuth
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ module MixAuth
2
+ class SessionsController < Devise::SessionsController
3
+ def new
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ module MixAuth
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,45 @@
1
+ module MixAuth
2
+ class User
3
+ include Mongoid::Document
4
+ # Include default devise modules. Others available are:
5
+ # :token_authenticatable, :confirmable,
6
+ # :lockable, :timeoutable and :omniauthable
7
+ devise :database_authenticatable, :registerable,
8
+ :recoverable, :rememberable, :trackable, :validatable
9
+
10
+ ## Database authenticatable
11
+ field :email, :type => String, :default => ""
12
+ field :encrypted_password, :type => String, :default => ""
13
+
14
+ validates_presence_of :email
15
+ validates_presence_of :encrypted_password
16
+
17
+ ## Recoverable
18
+ field :reset_password_token, :type => String
19
+ field :reset_password_sent_at, :type => Time
20
+
21
+ ## Rememberable
22
+ field :remember_created_at, :type => Time
23
+
24
+ ## Trackable
25
+ field :sign_in_count, :type => Integer, :default => 0
26
+ field :current_sign_in_at, :type => Time
27
+ field :last_sign_in_at, :type => Time
28
+ field :current_sign_in_ip, :type => String
29
+ field :last_sign_in_ip, :type => String
30
+
31
+ ## Confirmable
32
+ # field :confirmation_token, :type => String
33
+ # field :confirmed_at, :type => Time
34
+ # field :confirmation_sent_at, :type => Time
35
+ # field :unconfirmed_email, :type => String # Only if using reconfirmable
36
+
37
+ ## Lockable
38
+ # field :failed_attempts, :type => Integer, :default => 0 # Only if lock strategy is :failed_attempts
39
+ # field :unlock_token, :type => String # Only if unlock strategy is :email or :both
40
+ # field :locked_at, :type => Time
41
+
42
+ ## Token authenticatable
43
+ # field :authentication_token, :type => String
44
+ end
45
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Auth</title>
5
+ <%= stylesheet_link_tag "auth/application", :media => "all" %>
6
+ <%= javascript_include_tag "auth/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+ <div><%= flash[:notice] %> </div>
11
+ <div><%= flash[:alert] %> </div>
12
+ <%= yield %>
13
+
14
+ </body>
15
+ </html>
@@ -0,0 +1,12 @@
1
+ <h2>Resend confirmation instructions</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div><%= f.label :email %><br />
7
+ <%= f.email_field :email %></div>
8
+
9
+ <div><%= f.submit "Resend confirmation instructions" %></div>
10
+ <% end %>
11
+
12
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,5 @@
1
+ <p>Welcome <%= @resource.email %>!</p>
2
+
3
+ <p>You can confirm your account email through the link below:</p>
4
+
5
+ <p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
@@ -0,0 +1,8 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>Someone has requested a link to change your password, and you can do this through the link below.</p>
4
+
5
+ <p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
6
+
7
+ <p>If you didn't request this, please ignore this email.</p>
8
+ <p>Your password won't change until you access the link above and create a new one.</p>
@@ -0,0 +1,7 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
4
+
5
+ <p>Click the link below to unlock your account:</p>
6
+
7
+ <p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
@@ -0,0 +1,16 @@
1
+ <h2>Change your password</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+ <%= f.hidden_field :reset_password_token %>
6
+
7
+ <div><%= f.label :password, "New password" %><br />
8
+ <%= f.password_field :password %></div>
9
+
10
+ <div><%= f.label :password_confirmation, "Confirm new password" %><br />
11
+ <%= f.password_field :password_confirmation %></div>
12
+
13
+ <div><%= f.submit "Change my password" %></div>
14
+ <% end %>
15
+
16
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,12 @@
1
+ <h2>Forgot your password?</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div><%= f.label :email %><br />
7
+ <%= f.email_field :email %></div>
8
+
9
+ <div><%= f.submit "Send me reset password instructions" %></div>
10
+ <% end %>
11
+
12
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,25 @@
1
+ <h2>Edit <%= resource_name.to_s.humanize %></h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div><%= f.label :email %><br />
7
+ <%= f.email_field :email %></div>
8
+
9
+ <div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
10
+ <%= f.password_field :password, :autocomplete => "off" %></div>
11
+
12
+ <div><%= f.label :password_confirmation %><br />
13
+ <%= f.password_field :password_confirmation %></div>
14
+
15
+ <div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
16
+ <%= f.password_field :current_password %></div>
17
+
18
+ <div><%= f.submit "Update" %></div>
19
+ <% end %>
20
+
21
+ <h3>Cancel my account</h3>
22
+
23
+ <p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>.</p>
24
+
25
+ <%= link_to "Back", :back %>
@@ -0,0 +1,18 @@
1
+ <h2>Sign up</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div><%= f.label :email %><br />
7
+ <%= f.email_field :email %></div>
8
+
9
+ <div><%= f.label :password %><br />
10
+ <%= f.password_field :password %></div>
11
+
12
+ <div><%= f.label :password_confirmation %><br />
13
+ <%= f.password_field :password_confirmation %></div>
14
+
15
+ <div><%= f.submit "Sign up" %></div>
16
+ <% end %>
17
+
18
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,17 @@
1
+ <h2>Sign in</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
4
+ <div><%= f.label :email %><br />
5
+ <%= f.email_field :email %></div>
6
+
7
+ <div><%= f.label :password %><br />
8
+ <%= f.password_field :password %></div>
9
+
10
+ <% if devise_mapping.rememberable? -%>
11
+ <div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
12
+ <% end -%>
13
+
14
+ <div><%= f.submit t("submit_sign_in") %></div>
15
+ <% end %>
16
+
17
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,25 @@
1
+ <%- if controller_name != 'sessions' %>
2
+ <%= link_to "Sign in", new_session_path(resource_name) %><br />
3
+ <% end -%>
4
+
5
+ <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6
+ <%= link_to "Sign up", new_registration_path(resource_name) %><br />
7
+ <% end -%>
8
+
9
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
10
+ <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
11
+ <% end -%>
12
+
13
+ <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
15
+ <% end -%>
16
+
17
+ <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
19
+ <% end -%>
20
+
21
+ <%- if devise_mapping.omniauthable? %>
22
+ <%- resource_class.omniauth_providers.each do |provider| %>
23
+ <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
24
+ <% end -%>
25
+ <% end -%>
@@ -0,0 +1,12 @@
1
+ <h2>Resend unlock instructions</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div><%= f.label :email %><br />
7
+ <%= f.email_field :email %></div>
8
+
9
+ <div><%= f.submit "Resend unlock instructions" %></div>
10
+ <% end %>
11
+
12
+ <%= render "devise/shared/links" %>
@@ -1,13 +1,20 @@
1
1
  # Use this hook to configure devise mailer, warden hooks and so forth.
2
2
  # Many of these configuration options can be set straight in your model.
3
3
  Devise.setup do |config|
4
+
5
+
6
+ #config.router_name = :auth_user
7
+ #
8
+
9
+ #config.action_mailer.default_url_options = { :host => 'localhost:3000' }
10
+
4
11
  # ==> Mailer Configuration
5
12
  # Configure the e-mail address which will be shown in Devise::Mailer,
6
13
  # note that it will be overwritten if you use your own mailer class with default "from" parameter.
7
14
  config.mailer_sender = "sadjow@mixinternet.com.br"
8
15
 
9
16
  # Configure the class responsible to send e-mails.
10
- # config.mailer = "Devise::Mailer"
17
+ #config.mailer = "Devise::Mailer"
11
18
 
12
19
  # ==> ORM configuration
13
20
  # Load and configure the ORM. Supports :active_record (default) and
@@ -82,7 +89,7 @@ Devise.setup do |config|
82
89
  config.stretches = Rails.env.test? ? 1 : 10
83
90
 
84
91
  # Setup a pepper to generate the encrypted password.
85
- # config.pepper = "4a428d33a7f2f1d8f58481c17987d070ebcfb5390d1159adff4b1f694f2007c4667ecd6e59fbfc3b7ed30e4fce4b6163fb72b83b778890f26d2d7172a4d9dbff"
92
+ # config.pepper = "2d64e716afba701787bd988f00ce42bc2ddad6ecadded3cb380403092bb1787634af6549c23aade13adc9dad9d90d0a954b7a7e9e9e5d3dfcfb33174b8cba570"
86
93
 
87
94
  # ==> Configuration for :confirmable
88
95
  # A period that the user is allowed to access the website even without
@@ -178,7 +185,7 @@ Devise.setup do |config|
178
185
  # Turn scoped views on. Before rendering "sessions/new", it will first check for
179
186
  # "users/sessions/new". It's turned off by default because it's slower if you
180
187
  # are using only default views.
181
- # config.scoped_views = false
188
+ config.scoped_views = true
182
189
 
183
190
  # Configure the default scope given to Warden. By default it's the first
184
191
  # devise role declared in your routes (usually :user).
@@ -224,7 +231,7 @@ Devise.setup do |config|
224
231
  # mount MyEngine, at: "/my_engine"
225
232
  #
226
233
  # The router that invoked `devise_for`, in the example above, would be:
227
- # config.router_name = :my_engine
234
+ config.router_name = :auth
228
235
  #
229
236
  # When using omniauth, Devise cannot automatically set Omniauth path,
230
237
  # so you need to do it manually. For the users scope, it would be:
@@ -0,0 +1 @@
1
+ I18n.default_locale = :"pt-BR"
@@ -7,15 +7,4 @@ pt-BR:
7
7
  user:
8
8
  email: 'E-mail'
9
9
  password: 'Senha'
10
- remember_me: 'Lembrar de mim da proxima vez.'
11
-
12
- activerecord:
13
- attributes:
14
- user:
15
- email: 'E-mail'
16
- password: 'Senha'
17
- password_confirmation: 'Senha'
18
-
19
- users:
20
- users: 'Usuários'
21
- user: 'Usuário'
10
+ remember_me: 'Lembrar de mim da proxima vez.'
data/config/routes.rb CHANGED
@@ -1,9 +1,3 @@
1
- Rails.application.routes.draw do
2
-
3
- devise_for :users
4
-
5
- namespace :admix do
6
- resources :users
7
- end
8
-
9
- end
1
+ MixAuth::Engine.routes.draw do
2
+ devise_for :users, class_name: 'MixAuth::User', module: :devise, mounted: true
3
+ end
@@ -0,0 +1,5 @@
1
+ module MixAuth
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace MixAuth
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module MixAuth
2
+ VERSION = "1.0.0.alpha.1"
3
+ end
data/lib/mix-auth.rb CHANGED
@@ -1 +1,7 @@
1
- require 'auth'
1
+ require "mix-auth/engine"
2
+
3
+ require "mongoid"
4
+ require "devise"
5
+
6
+ module MixAuth
7
+ end
File without changes
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mix-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
5
- prerelease:
4
+ version: 1.0.0.alpha.1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
- - Sadjow
9
- - Rafael
8
+ - Sadjow Leão
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-01-14 00:00:00.000000000 Z
12
+ date: 2012-12-24 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rails
@@ -76,87 +75,45 @@ dependencies:
76
75
  - - ~>
77
76
  - !ruby/object:Gem::Version
78
77
  version: 3.0.15
79
- - !ruby/object:Gem::Dependency
80
- name: cancan
81
- requirement: !ruby/object:Gem::Requirement
82
- none: false
83
- requirements:
84
- - - ! '>='
85
- - !ruby/object:Gem::Version
86
- version: '0'
87
- type: :runtime
88
- prerelease: false
89
- version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
- requirements:
92
- - - ! '>='
93
- - !ruby/object:Gem::Version
94
- version: '0'
95
- - !ruby/object:Gem::Dependency
96
- name: mix-rails
97
- requirement: !ruby/object:Gem::Requirement
98
- none: false
99
- requirements:
100
- - - ~>
101
- - !ruby/object:Gem::Version
102
- version: 0.3.0
103
- type: :runtime
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
- requirements:
108
- - - ~>
109
- - !ruby/object:Gem::Version
110
- version: 0.3.0
111
- - !ruby/object:Gem::Dependency
112
- name: will_paginate_mongoid
113
- requirement: !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
116
- - - ! '>='
117
- - !ruby/object:Gem::Version
118
- version: '0'
119
- type: :runtime
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
- requirements:
124
- - - ! '>='
125
- - !ruby/object:Gem::Version
126
- version: '0'
127
- description: Description of Auth.
78
+ description: This module provides auth funcionality.
128
79
  email:
129
80
  - sadjow@gmail.com
130
- - rafbgarcia@gmail.com
131
81
  executables: []
132
82
  extensions: []
133
83
  extra_rdoc_files: []
134
84
  files:
135
- - app/controllers/admix/users_controller.rb
136
- - app/assets/stylesheets/admix/users.css
137
- - app/assets/javascripts/admix/users.js
138
- - app/helpers/admix/users_helper.rb
139
- - app/models/admix/users_datagrid.rb
140
- - app/models/ability.rb
141
- - app/models/user.rb
142
- - app/views/admix/users/_show.html.haml
143
- - app/views/admix/users/_table_actions.html.haml
144
- - app/views/admix/users/_form_fields.html.haml
145
- - config/locales/auth.en.yml
146
- - config/locales/devise.pt-BR.yml
147
- - config/locales/devise.en.yml
148
- - config/locales/auth.pt-BR.yml
85
+ - app/assets/stylesheets/mix-auth/application.css
86
+ - app/assets/javascripts/mix-auth/application.js
87
+ - app/views/layouts/auth/application.html.erb
88
+ - app/views/users/passwords/edit.html.erb
89
+ - app/views/users/passwords/new.html.erb
90
+ - app/views/users/mailer/unlock_instructions.html.erb
91
+ - app/views/users/mailer/confirmation_instructions.html.erb
92
+ - app/views/users/mailer/reset_password_instructions.html.erb
93
+ - app/views/users/unlocks/new.html.erb
94
+ - app/views/users/registrations/edit.html.erb
95
+ - app/views/users/registrations/new.html.erb
96
+ - app/views/users/confirmations/new.html.erb
97
+ - app/views/users/sessions/new.html.erb
98
+ - app/views/users/shared/_links.erb
99
+ - app/controllers/mix-auth/application_controller.rb
100
+ - app/controllers/mix-auth/sessions_controller.rb
101
+ - app/models/mix-auth/user.rb
102
+ - app/helpers/mix-auth/application_helper.rb
149
103
  - config/initializers/devise.rb
104
+ - config/initializers/locales.rb
150
105
  - config/routes.rb
151
- - lib/tasks/auth_tasks.rake
152
- - lib/auth/version.rb
153
- - lib/auth/engine.rb
154
- - lib/auth.rb
106
+ - config/locales/devise.pt-BR.yml
107
+ - config/locales/auth.pt-BR.yml
108
+ - config/locales/devise.en.yml
109
+ - lib/tasks/mix-auth_tasks.rake
155
110
  - lib/mix-auth.rb
111
+ - lib/mix-auth/version.rb
112
+ - lib/mix-auth/engine.rb
156
113
  - MIT-LICENSE
157
114
  - Rakefile
158
115
  - README.rdoc
159
- homepage: http://github.com/mixinternet/mix-auth
116
+ homepage: https://github.com/mixinternet/mix-auth
160
117
  licenses: []
161
118
  post_install_message:
162
119
  rdoc_options: []
@@ -170,20 +127,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
127
  version: '0'
171
128
  segments:
172
129
  - 0
173
- hash: 2479283267806110614
130
+ hash: -1777930231052932861
174
131
  required_rubygems_version: !ruby/object:Gem::Requirement
175
132
  none: false
176
133
  requirements:
177
- - - ! '>='
134
+ - - ! '>'
178
135
  - !ruby/object:Gem::Version
179
- version: '0'
180
- segments:
181
- - 0
182
- hash: 2479283267806110614
136
+ version: 1.3.1
183
137
  requirements: []
184
138
  rubyforge_project:
185
139
  rubygems_version: 1.8.24
186
140
  signing_key:
187
141
  specification_version: 3
188
- summary: Summary of Auth.
142
+ summary: This module provides auth funcionality.
189
143
  test_files: []
@@ -1,2 +0,0 @@
1
- // Place all the behaviors and hooks related to the matching controller here.
2
- // All this logic will automatically be available in application.js.
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,8 +0,0 @@
1
- class Admix::UsersController < Admix::InheritedController
2
-
3
- protected
4
- def crumb_field
5
- "email"
6
- end
7
-
8
- end
@@ -1,5 +0,0 @@
1
- module Admix::UsersHelper
2
- def form_attributes
3
- %w(email password password_confirmation)
4
- end
5
- end
@@ -1,28 +0,0 @@
1
- class Ability
2
- include CanCan::Ability
3
-
4
- def initialize(user)
5
- # Define abilities for the passed in user here. For example:
6
- #
7
- user ||= User.new # guest user (not logged in)
8
- if user.is?(:admin)
9
- can :manage, :all
10
- else
11
- can :read, :all
12
- end
13
- #
14
- # The first argument to `can` is the action you are giving the user permission to do.
15
- # If you pass :manage it will apply to every action. Other common actions here are
16
- # :read, :create, :update and :destroy.
17
- #
18
- # The second argument is the resource the user can perform the action on. If you pass
19
- # :all it will apply to every resource. Otherwise pass a Ruby class of the resource.
20
- #
21
- # The third argument is an optional hash of conditions to further filter the objects.
22
- # For example, here the user can only update published articles.
23
- #
24
- # can :update, Article, :published => true
25
- #
26
- # See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilities
27
- end
28
- end
@@ -1,17 +0,0 @@
1
- class Admix::UsersDatagrid
2
-
3
- include Datagrid
4
-
5
- scope do
6
- User.desc(:email)
7
- end
8
-
9
- filter :email, :string
10
- filter :last_sign_in_at, :date
11
-
12
- column :email
13
- column :last_sign_in_at
14
-
15
- include Admix::TableActions
16
-
17
- end
data/app/models/user.rb DELETED
@@ -1,68 +0,0 @@
1
- class User
2
- include Mongoid::Document
3
-
4
- ROLES = %w[admin content_manager]
5
-
6
- attr_accessible :roles
7
-
8
- # Include default devise modules. Others available are:
9
- # :token_authenticatable, :confirmable,
10
- # :lockable, :timeoutable and :omniauthable
11
- devise :database_authenticatable, :registerable,
12
- :recoverable, :rememberable, :trackable, :validatable
13
-
14
- ## Database authenticatable
15
- field :email, :type => String, :default => ""
16
- field :encrypted_password, :type => String, :default => ""
17
-
18
- validates_presence_of :email
19
- validates_presence_of :encrypted_password
20
-
21
- ## Recoverable
22
- field :reset_password_token, :type => String
23
- field :reset_password_sent_at, :type => Time
24
-
25
- ## Rememberable
26
- field :remember_created_at, :type => Time
27
-
28
- ## Trackable
29
- field :sign_in_count, :type => Integer, :default => 0
30
- field :current_sign_in_at, :type => Time
31
- field :last_sign_in_at, :type => Time
32
- field :current_sign_in_ip, :type => String
33
- field :last_sign_in_ip, :type => String
34
-
35
-
36
- ## Confirmable
37
- # field :confirmation_token, :type => String
38
- # field :confirmed_at, :type => Time
39
- # field :confirmation_sent_at, :type => Time
40
- # field :unconfirmed_email, :type => String # Only if using reconfirmable
41
-
42
- ## Lockable
43
- # field :failed_attempts, :type => Integer, :default => 0 # Only if lock strategy is :failed_attempts
44
- # field :unlock_token, :type => String # Only if unlock strategy is :email or :both
45
- # field :locked_at, :type => Time
46
-
47
- ## Token authenticatable
48
- # field :authentication_token, :type => String
49
-
50
-
51
- #field :role, :type => String
52
- field :roles_mask, :type => Integer
53
-
54
- def roles=(roles)
55
- self.roles_mask = (roles & ROLES).map { |r| 2**ROLES.index(r) }.inject(0, :+)
56
- end
57
-
58
- def roles
59
- ROLES.reject do |r|
60
- ((roles_mask || 0) & 2**ROLES.index(r)).zero?
61
- end
62
- end
63
-
64
- def is?(role)
65
- roles.include?(role.to_s)
66
- end
67
-
68
- end
@@ -1,7 +0,0 @@
1
- = f.input :email, as: 'string'
2
- = f.input :password, as: 'password'
3
- - for role in User::ROLES
4
- = check_box_tag "user[roles][#{role}]", role, @user.roles.include?(role), {:name => "user[roles][]"}
5
- = label_tag "user_roles_#{role}", role.humanize
6
- %br
7
- = hidden_field_tag "user[roles][]", ""
@@ -1,7 +0,0 @@
1
- %dl
2
- %dt= t('albums.name')
3
- %dd= resource.name
4
- %dt= t('albums.date')
5
- %dd= resource.date
6
-
7
- = render('admix/photos/upload')
@@ -1,4 +0,0 @@
1
- = link_to image_tag('albums/photos.png'), resource_url([resource, :photos])
2
- = link_to image_tag('admix/zoom.png'), resource_url(resource)
3
- = link_to image_tag('admix/page_edit.png'), edit_resource_url(resource)
4
- = link_to image_tag('admix/cancel.png'), resource_url(resource), method: :delete, data: { confirm: t('admix.crud.destroy_confirm') }
@@ -1,17 +0,0 @@
1
- en:
2
- submit_sign_in: "Entrar"
3
-
4
-
5
- helpers:
6
- label:
7
- user:
8
- email: 'E-mail'
9
- password: 'Senha'
10
- remember_me: 'Lembrar de mim da proxima vez.'
11
-
12
- activerecord:
13
- attributes:
14
- user:
15
- email: 'E-mail'
16
- password: 'Password'
17
- password_confirmation: 'Password confirmation'
data/lib/auth/engine.rb DELETED
@@ -1,19 +0,0 @@
1
- module Auth
2
- class Engine < ::Rails::Engine
3
-
4
- def navigation
5
- if defined? Admix
6
- Admix::Navigation::NavBar.post_menu do
7
- Admix::Navigation::NavBar.find(:general) do |menu|
8
- menu.submenu do |submenu|
9
- submenu.key = :users
10
- submenu.title = I18n.t 'users.users'
11
- submenu.url = 'admix_users_url'
12
- end
13
- end
14
- end
15
- end
16
- end
17
-
18
- end
19
- end
data/lib/auth/version.rb DELETED
@@ -1,3 +0,0 @@
1
- module Auth
2
- VERSION = "0.4.0"
3
- end
data/lib/auth.rb DELETED
@@ -1,5 +0,0 @@
1
- require "auth/engine"
2
- require 'devise'
3
-
4
- module Auth
5
- end