mix-auth 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = MixAuth
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Auth'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
@@ -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" %>
@@ -0,0 +1,239 @@
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
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
+
11
+ # ==> Mailer Configuration
12
+ # Configure the e-mail address which will be shown in Devise::Mailer,
13
+ # note that it will be overwritten if you use your own mailer class with default "from" parameter.
14
+ config.mailer_sender = "sadjow@mixinternet.com.br"
15
+
16
+ # Configure the class responsible to send e-mails.
17
+ #config.mailer = "Devise::Mailer"
18
+
19
+ # ==> ORM configuration
20
+ # Load and configure the ORM. Supports :active_record (default) and
21
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
22
+ # available as additional gems.
23
+ require 'devise/orm/mongoid'
24
+
25
+ # ==> Configuration for any authentication mechanism
26
+ # Configure which keys are used when authenticating a user. The default is
27
+ # just :email. You can configure it to use [:username, :subdomain], so for
28
+ # authenticating a user, both parameters are required. Remember that those
29
+ # parameters are used only when authenticating and not when retrieving from
30
+ # session. If you need permissions, you should implement that in a before filter.
31
+ # You can also supply a hash where the value is a boolean determining whether
32
+ # or not authentication should be aborted when the value is not present.
33
+ # config.authentication_keys = [ :email ]
34
+
35
+ # Configure parameters from the request object used for authentication. Each entry
36
+ # given should be a request method and it will automatically be passed to the
37
+ # find_for_authentication method and considered in your model lookup. For instance,
38
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
39
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
40
+ # config.request_keys = []
41
+
42
+ # Configure which authentication keys should be case-insensitive.
43
+ # These keys will be downcased upon creating or modifying a user and when used
44
+ # to authenticate or find a user. Default is :email.
45
+ config.case_insensitive_keys = [ :email ]
46
+
47
+ # Configure which authentication keys should have whitespace stripped.
48
+ # These keys will have whitespace before and after removed upon creating or
49
+ # modifying a user and when used to authenticate or find a user. Default is :email.
50
+ config.strip_whitespace_keys = [ :email ]
51
+
52
+ # Tell if authentication through request.params is enabled. True by default.
53
+ # It can be set to an array that will enable params authentication only for the
54
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
55
+ # enable it only for database (email + password) authentication.
56
+ # config.params_authenticatable = true
57
+
58
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
59
+ # It can be set to an array that will enable http authentication only for the
60
+ # given strategies, for example, `config.http_authenticatable = [:token]` will
61
+ # enable it only for token authentication.
62
+ # config.http_authenticatable = false
63
+
64
+ # If http headers should be returned for AJAX requests. True by default.
65
+ # config.http_authenticatable_on_xhr = true
66
+
67
+ # The realm used in Http Basic Authentication. "Application" by default.
68
+ # config.http_authentication_realm = "Application"
69
+
70
+ # It will change confirmation, password recovery and other workflows
71
+ # to behave the same regardless if the e-mail provided was right or wrong.
72
+ # Does not affect registerable.
73
+ # config.paranoid = true
74
+
75
+ # By default Devise will store the user in session. You can skip storage for
76
+ # :http_auth and :token_auth by adding those symbols to the array below.
77
+ # Notice that if you are skipping storage for all authentication paths, you
78
+ # may want to disable generating routes to Devise's sessions controller by
79
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
80
+ config.skip_session_storage = [:http_auth]
81
+
82
+ # ==> Configuration for :database_authenticatable
83
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
84
+ # using other encryptors, it sets how many times you want the password re-encrypted.
85
+ #
86
+ # Limiting the stretches to just one in testing will increase the performance of
87
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
88
+ # a value less than 10 in other environments.
89
+ config.stretches = Rails.env.test? ? 1 : 10
90
+
91
+ # Setup a pepper to generate the encrypted password.
92
+ # config.pepper = "2d64e716afba701787bd988f00ce42bc2ddad6ecadded3cb380403092bb1787634af6549c23aade13adc9dad9d90d0a954b7a7e9e9e5d3dfcfb33174b8cba570"
93
+
94
+ # ==> Configuration for :confirmable
95
+ # A period that the user is allowed to access the website even without
96
+ # confirming his account. For instance, if set to 2.days, the user will be
97
+ # able to access the website for two days without confirming his account,
98
+ # access will be blocked just in the third day. Default is 0.days, meaning
99
+ # the user cannot access the website without confirming his account.
100
+ # config.allow_unconfirmed_access_for = 2.days
101
+
102
+ # If true, requires any email changes to be confirmed (exactly the same way as
103
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
104
+ # db field (see migrations). Until confirmed new email is stored in
105
+ # unconfirmed email column, and copied to email column on successful confirmation.
106
+ config.reconfirmable = true
107
+
108
+ # Defines which key will be used when confirming an account
109
+ # config.confirmation_keys = [ :email ]
110
+
111
+ # ==> Configuration for :rememberable
112
+ # The time the user will be remembered without asking for credentials again.
113
+ # config.remember_for = 2.weeks
114
+
115
+ # If true, extends the user's remember period when remembered via cookie.
116
+ # config.extend_remember_period = false
117
+
118
+ # Options to be passed to the created cookie. For instance, you can set
119
+ # :secure => true in order to force SSL only cookies.
120
+ # config.rememberable_options = {}
121
+
122
+ # ==> Configuration for :validatable
123
+ # Range for password length. Default is 6..128.
124
+ # config.password_length = 6..128
125
+
126
+ # Email regex used to validate email formats. It simply asserts that
127
+ # an one (and only one) @ exists in the given string. This is mainly
128
+ # to give user feedback and not to assert the e-mail validity.
129
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
130
+
131
+ # ==> Configuration for :timeoutable
132
+ # The time you want to timeout the user session without activity. After this
133
+ # time the user will be asked for credentials again. Default is 30 minutes.
134
+ # config.timeout_in = 30.minutes
135
+
136
+ # If true, expires auth token on session timeout.
137
+ # config.expire_auth_token_on_timeout = false
138
+
139
+ # ==> Configuration for :lockable
140
+ # Defines which strategy will be used to lock an account.
141
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
142
+ # :none = No lock strategy. You should handle locking by yourself.
143
+ # config.lock_strategy = :failed_attempts
144
+
145
+ # Defines which key will be used when locking and unlocking an account
146
+ # config.unlock_keys = [ :email ]
147
+
148
+ # Defines which strategy will be used to unlock an account.
149
+ # :email = Sends an unlock link to the user email
150
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
151
+ # :both = Enables both strategies
152
+ # :none = No unlock strategy. You should handle unlocking by yourself.
153
+ # config.unlock_strategy = :both
154
+
155
+ # Number of authentication tries before locking an account if lock_strategy
156
+ # is failed attempts.
157
+ # config.maximum_attempts = 20
158
+
159
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
160
+ # config.unlock_in = 1.hour
161
+
162
+ # ==> Configuration for :recoverable
163
+ #
164
+ # Defines which key will be used when recovering the password for an account
165
+ # config.reset_password_keys = [ :email ]
166
+
167
+ # Time interval you can reset your password with a reset password key.
168
+ # Don't put a too small interval or your users won't have the time to
169
+ # change their passwords.
170
+ config.reset_password_within = 6.hours
171
+
172
+ # ==> Configuration for :encryptable
173
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
174
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
175
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
176
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
177
+ # REST_AUTH_SITE_KEY to pepper)
178
+ # config.encryptor = :sha512
179
+
180
+ # ==> Configuration for :token_authenticatable
181
+ # Defines name of the authentication token params key
182
+ # config.token_authentication_key = :auth_token
183
+
184
+ # ==> Scopes configuration
185
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
186
+ # "users/sessions/new". It's turned off by default because it's slower if you
187
+ # are using only default views.
188
+ config.scoped_views = true
189
+
190
+ # Configure the default scope given to Warden. By default it's the first
191
+ # devise role declared in your routes (usually :user).
192
+ # config.default_scope = :user
193
+
194
+ # Set this configuration to false if you want /users/sign_out to sign out
195
+ # only the current scope. By default, Devise signs out all scopes.
196
+ # config.sign_out_all_scopes = true
197
+
198
+ # ==> Navigation configuration
199
+ # Lists the formats that should be treated as navigational. Formats like
200
+ # :html, should redirect to the sign in page when the user does not have
201
+ # access, but formats like :xml or :json, should return 401.
202
+ #
203
+ # If you have any extra navigational formats, like :iphone or :mobile, you
204
+ # should add them to the navigational formats lists.
205
+ #
206
+ # The "*/*" below is required to match Internet Explorer requests.
207
+ # config.navigational_formats = ["*/*", :html]
208
+
209
+ # The default HTTP method used to sign out a resource. Default is :delete.
210
+ config.sign_out_via = :delete
211
+
212
+ # ==> OmniAuth
213
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
214
+ # up on your models and hooks.
215
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
216
+
217
+ # ==> Warden configuration
218
+ # If you want to use other strategies, that are not supported by Devise, or
219
+ # change the failure app, you can configure them inside the config.warden block.
220
+ #
221
+ # config.warden do |manager|
222
+ # manager.intercept_401 = false
223
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
224
+ # end
225
+
226
+ # ==> Mountable engine configurations
227
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
228
+ # is mountable, there are some extra configurations to be taken into account.
229
+ # The following options are available, assuming the engine is mounted as:
230
+ #
231
+ # mount MyEngine, at: "/my_engine"
232
+ #
233
+ # The router that invoked `devise_for`, in the example above, would be:
234
+ config.router_name = :auth
235
+ #
236
+ # When using omniauth, Devise cannot automatically set Omniauth path,
237
+ # so you need to do it manually. For the users scope, it would be:
238
+ # config.omniauth_path_prefix = "/my_engine/users/auth"
239
+ end
@@ -0,0 +1 @@
1
+ I18n.default_locale = :"pt-BR"
@@ -0,0 +1,10 @@
1
+ pt-BR:
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.'
@@ -0,0 +1,58 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ errors:
5
+ messages:
6
+ expired: "has expired, please request a new one"
7
+ not_found: "not found"
8
+ already_confirmed: "was already confirmed, please try signing in"
9
+ not_locked: "was not locked"
10
+ not_saved:
11
+ one: "1 error prohibited this %{resource} from being saved:"
12
+ other: "%{count} errors prohibited this %{resource} from being saved:"
13
+
14
+ devise:
15
+ failure:
16
+ already_authenticated: 'You are already signed in.'
17
+ unauthenticated: 'You need to sign in or sign up before continuing.'
18
+ unconfirmed: 'You have to confirm your account before continuing.'
19
+ locked: 'Your account is locked.'
20
+ invalid: 'Invalid email or password.'
21
+ invalid_token: 'Invalid authentication token.'
22
+ timeout: 'Your session expired, please sign in again to continue.'
23
+ inactive: 'Your account was not activated yet.'
24
+ sessions:
25
+ signed_in: 'Signed in successfully.'
26
+ signed_out: 'Signed out successfully.'
27
+ passwords:
28
+ send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
29
+ updated: 'Your password was changed successfully. You are now signed in.'
30
+ updated_not_active: 'Your password was changed successfully.'
31
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
32
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
33
+ confirmations:
34
+ send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
35
+ send_paranoid_instructions: 'If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
36
+ confirmed: 'Your account was successfully confirmed. You are now signed in.'
37
+ registrations:
38
+ signed_up: 'Welcome! You have signed up successfully.'
39
+ signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
40
+ signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
41
+ signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
42
+ updated: 'You updated your account successfully.'
43
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
44
+ destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
45
+ unlocks:
46
+ send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
47
+ unlocked: 'Your account has been unlocked successfully. Please sign in to continue.'
48
+ send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
49
+ omniauth_callbacks:
50
+ success: 'Successfully authenticated from %{kind} account.'
51
+ failure: 'Could not authenticate you from %{kind} because "%{reason}".'
52
+ mailer:
53
+ confirmation_instructions:
54
+ subject: 'Confirmation instructions'
55
+ reset_password_instructions:
56
+ subject: 'Reset password instructions'
57
+ unlock_instructions:
58
+ subject: 'Unlock Instructions'
@@ -0,0 +1,59 @@
1
+ # encoding: UTF-8
2
+ # pt-BR translations for Devise
3
+ pt-BR:
4
+ devise:
5
+ confirmations:
6
+ confirmed: 'Sua conta foi confirmada com sucesso. Você está logado.'
7
+ send_instructions: 'Dentro de minutos, você receberá um e-mail com instruções para a confirmação da sua conta.'
8
+ send_paranoid_instructions: 'Se o seu endereço de e-mail estiver cadastrado, você receberá uma mensagem com instruções para confirmação da sua conta.'
9
+ failure:
10
+ already_authenticated: 'Você já está logado.'
11
+ inactive: 'Sua conta ainda não foi ativada.'
12
+ invalid: 'E-mail ou senha inválidos.'
13
+ invalid_token: 'O token de autenticação não é válido.'
14
+ locked: 'Sua conta está bloqueada.'
15
+ timeout: 'Sua sessão expirou, por favor, efetue login novamente para continuar.'
16
+ unauthenticated: 'Para continuar, efetue login ou registre-se.'
17
+ unconfirmed: 'Antes de continuar, confirme a sua conta.'
18
+ mailer:
19
+ confirmation_instructions:
20
+ subject: 'Instruções de confirmação'
21
+ reset_password_instructions:
22
+ subject: 'Instruções de troca de senha'
23
+ unlock_instructions:
24
+ subject: 'Instruções de desbloqueio'
25
+ omniauth_callbacks:
26
+ failure: 'Não foi possível autenticá-lo como %{kind} porque "%{reason}".'
27
+ success: 'Autenticado com sucesso com uma conta de %{kind}.'
28
+ passwords:
29
+ no_token: "Você só pode acessar essa página através de um e-mail de troca de senha. Se já estiver acessando por um e-mail, verifique se usou a URL completa fornecida."
30
+ send_instructions: 'Dentro de minutos, você receberá um e-mail com instruções para a troca da sua senha.'
31
+ send_paranoid_instructions: 'Se o seu endereço de e-mail estiver cadastrado, você receberá um link de recuperação da senha via e-mail.'
32
+ updated: 'Sua senha foi alterada com sucesso. Você está logado.'
33
+ updated_not_active: 'Sua senha foi alterada com sucesso.'
34
+ registrations:
35
+ destroyed: 'Tchau! Sua conta foi cancelada com sucesso. Esperamos vê-lo novamente em breve.'
36
+ signed_up: 'Login efetuado com sucesso. Se não foi autorizado, a confirmação será enviada por e-mail.'
37
+ signed_up_but_inactive: 'Você foi cadastrado com sucesso. No entanto, não foi possível efetuar login, pois sua conta não foi ativada.'
38
+ signed_up_but_locked: 'Você foi cadastrado com sucesso. No entanto, não foi possível efetuar login, pois sua conta está bloqueada.'
39
+ signed_up_but_unconfirmed: 'Uma mensagem com um link de confirmação foi enviada para o seu endereço de e-mail. Por favor, abra o link para confirmar a sua conta.'
40
+ update_needs_confirmation: 'Você atualizou a sua conta com sucesso, mas o seu novo endereço de e-mail precisa ser confirmado. Por favor, acesse-o e clique no link de confirmação que enviamos.'
41
+ updated: 'Sua conta foi atualizada com sucesso.'
42
+ sessions:
43
+ signed_in: 'Login efetuado com sucesso!'
44
+ signed_out: 'Saiu com sucesso.'
45
+ unlocks:
46
+ send_instructions: 'Dentro de minutos, você receberá um email com instruções para o desbloqueio da sua conta.'
47
+ send_paranoid_instructions: 'Se sua conta existir, você receberá um e-mail com instruções para desbloqueá-la em alguns minutos.'
48
+ unlocked: 'Sua conta foi desbloqueada com sucesso. Efetue login para continuar.'
49
+
50
+ errors:
51
+ messages:
52
+ already_confirmed: "já foi confirmado"
53
+ confirmation_period_expired: "precisa ser confirmada em até %{period}, por favor, solicite uma nova"
54
+ expired: "expirou, por favor, solicite uma nova"
55
+ not_found: "não encontrado"
56
+ not_locked: "não foi bloqueado"
57
+ not_saved:
58
+ one: "Não foi possível salvar %{resource}: 1 erro"
59
+ other: "Não foi possível salvar %{resource}: %{count} erros."
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
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 = "0.1.0"
3
+ end
data/lib/mix-auth.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "mix-auth/engine"
2
+
3
+ require "mongoid"
4
+ require "devise"
5
+
6
+ module MixAuth
7
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :auth do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mix-auth
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Sadjow Leão
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.9
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.9
30
+ - !ruby/object:Gem::Dependency
31
+ name: devise
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 2.1.2
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.1.2
46
+ - !ruby/object:Gem::Dependency
47
+ name: devise-i18n
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: mongoid
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 3.0.15
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 3.0.15
78
+ description: This module provides auth funcionality.
79
+ email:
80
+ - sadjow@gmail.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files: []
84
+ files:
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
103
+ - config/initializers/devise.rb
104
+ - config/initializers/locales.rb
105
+ - config/routes.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
110
+ - lib/mix-auth.rb
111
+ - lib/mix-auth/version.rb
112
+ - lib/mix-auth/engine.rb
113
+ - MIT-LICENSE
114
+ - Rakefile
115
+ - README.rdoc
116
+ homepage: https://github.com/mixinternet/mix-auth
117
+ licenses: []
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ! '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ segments:
129
+ - 0
130
+ hash: 550318476984316709
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ segments:
138
+ - 0
139
+ hash: 550318476984316709
140
+ requirements: []
141
+ rubyforge_project:
142
+ rubygems_version: 1.8.24
143
+ signing_key:
144
+ specification_version: 3
145
+ summary: This module provides auth funcionality.
146
+ test_files: []