Commit 2abd054b0c3c3f1116840cf51444fc63e49057f6
1 parent
7f207d4a
Exists in
master
and in
4 other branches
update devise
Showing
8 changed files
with
57 additions
and
34 deletions
Show diff stats
Gemfile
@@ -7,7 +7,7 @@ gem "sqlite3" | @@ -7,7 +7,7 @@ gem "sqlite3" | ||
7 | gem "mysql2" | 7 | gem "mysql2" |
8 | 8 | ||
9 | # Auth | 9 | # Auth |
10 | -gem "devise", "~> 1.5" | 10 | +gem "devise", "~> 2.1.0" |
11 | 11 | ||
12 | # GITLAB patched libs | 12 | # GITLAB patched libs |
13 | gem "grit", :git => "https://github.com/gitlabhq/grit.git", :ref => "7f35cb98ff17d534a07e3ce6ec3d580f67402837" | 13 | gem "grit", :git => "https://github.com/gitlabhq/grit.git", :ref => "7f35cb98ff17d534a07e3ce6ec3d580f67402837" |
Gemfile.lock
@@ -148,10 +148,11 @@ GEM | @@ -148,10 +148,11 @@ GEM | ||
148 | nokogiri (>= 1.5.0) | 148 | nokogiri (>= 1.5.0) |
149 | daemons (1.1.8) | 149 | daemons (1.1.8) |
150 | database_cleaner (0.8.0) | 150 | database_cleaner (0.8.0) |
151 | - devise (1.5.3) | 151 | + devise (2.1.2) |
152 | bcrypt-ruby (~> 3.0) | 152 | bcrypt-ruby (~> 3.0) |
153 | - orm_adapter (~> 0.0.3) | ||
154 | - warden (~> 1.1) | 153 | + orm_adapter (~> 0.1) |
154 | + railties (~> 3.1) | ||
155 | + warden (~> 1.2.1) | ||
155 | diff-lcs (1.1.3) | 156 | diff-lcs (1.1.3) |
156 | drapper (0.8.4) | 157 | drapper (0.8.4) |
157 | email_spec (1.2.1) | 158 | email_spec (1.2.1) |
@@ -225,7 +226,7 @@ GEM | @@ -225,7 +226,7 @@ GEM | ||
225 | omniauth (1.1.0) | 226 | omniauth (1.1.0) |
226 | hashie (~> 1.2) | 227 | hashie (~> 1.2) |
227 | rack | 228 | rack |
228 | - orm_adapter (0.0.7) | 229 | + orm_adapter (0.3.0) |
229 | polyglot (0.3.3) | 230 | polyglot (0.3.3) |
230 | posix-spawn (0.3.6) | 231 | posix-spawn (0.3.6) |
231 | pry (0.9.9.6) | 232 | pry (0.9.9.6) |
@@ -356,7 +357,7 @@ GEM | @@ -356,7 +357,7 @@ GEM | ||
356 | raindrops (~> 0.7) | 357 | raindrops (~> 0.7) |
357 | vegas (0.1.11) | 358 | vegas (0.1.11) |
358 | rack (>= 1.0.0) | 359 | rack (>= 1.0.0) |
359 | - warden (1.2.0) | 360 | + warden (1.2.1) |
360 | rack (>= 1.0) | 361 | rack (>= 1.0) |
361 | webmock (1.8.7) | 362 | webmock (1.8.7) |
362 | addressable (>= 2.2.7) | 363 | addressable (>= 2.2.7) |
@@ -383,7 +384,7 @@ DEPENDENCIES | @@ -383,7 +384,7 @@ DEPENDENCIES | ||
383 | colored | 384 | colored |
384 | cucumber-rails | 385 | cucumber-rails |
385 | database_cleaner | 386 | database_cleaner |
386 | - devise (~> 1.5) | 387 | + devise (~> 2.1.0) |
387 | drapper | 388 | drapper |
388 | email_spec | 389 | email_spec |
389 | ffaker | 390 | ffaker |
app/controllers/application_controller.rb
@@ -52,7 +52,7 @@ class ApplicationController < ActionController::Base | @@ -52,7 +52,7 @@ class ApplicationController < ActionController::Base | ||
52 | 52 | ||
53 | def layout_by_resource | 53 | def layout_by_resource |
54 | if devise_controller? | 54 | if devise_controller? |
55 | - "devise" | 55 | + "devise_layout" |
56 | else | 56 | else |
57 | "application" | 57 | "application" |
58 | end | 58 | end |
app/views/layouts/devise.html.haml
config/initializers/devise.rb
@@ -93,10 +93,6 @@ Devise.setup do |config| | @@ -93,10 +93,6 @@ Devise.setup do |config| | ||
93 | # If true, extends the user's remember period when remembered via cookie. | 93 | # If true, extends the user's remember period when remembered via cookie. |
94 | # config.extend_remember_period = false | 94 | # config.extend_remember_period = false |
95 | 95 | ||
96 | - # If true, uses the password salt as remember token. This should be turned | ||
97 | - # to false if you are not using database authenticatable. | ||
98 | - config.use_salt_as_remember_token = true | ||
99 | - | ||
100 | # Options to be passed to the created cookie. For instance, you can set | 96 | # Options to be passed to the created cookie. For instance, you can set |
101 | # :secure => true in order to force SSL only cookies. | 97 | # :secure => true in order to force SSL only cookies. |
102 | # config.cookie_options = {} | 98 | # config.cookie_options = {} |
@@ -160,9 +156,9 @@ Devise.setup do |config| | @@ -160,9 +156,9 @@ Devise.setup do |config| | ||
160 | # Defines name of the authentication token params key | 156 | # Defines name of the authentication token params key |
161 | config.token_authentication_key = :private_token | 157 | config.token_authentication_key = :private_token |
162 | 158 | ||
163 | - # If true, authentication through token does not store user in session and needs | 159 | + # Authentication through token does not store user in session and needs |
164 | # to be supplied on each request. Useful if you are using the token as API token. | 160 | # to be supplied on each request. Useful if you are using the token as API token. |
165 | - config.stateless_token = true | 161 | + config.skip_session_storage << :token_auth |
166 | 162 | ||
167 | # ==> Scopes configuration | 163 | # ==> Scopes configuration |
168 | # Turn scoped views on. Before rendering "sessions/new", it will first check for | 164 | # Turn scoped views on. Before rendering "sessions/new", it will first check for |
config/locales/devise.en.yml
@@ -35,13 +35,11 @@ en: | @@ -35,13 +35,11 @@ en: | ||
35 | confirmed: 'Your account was successfully confirmed. You are now signed in.' | 35 | confirmed: 'Your account was successfully confirmed. You are now signed in.' |
36 | registrations: | 36 | registrations: |
37 | signed_up: 'Welcome! You have signed up successfully.' | 37 | signed_up: 'Welcome! You have signed up successfully.' |
38 | - inactive_signed_up: 'You have signed up successfully. However, we could not sign you in because your account is %{reason}.' | ||
39 | updated: 'You updated your account successfully.' | 38 | updated: 'You updated your account successfully.' |
40 | destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.' | 39 | destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.' |
41 | - reasons: | ||
42 | - inactive: 'inactive' | ||
43 | - unconfirmed: 'unconfirmed' | ||
44 | - locked: 'locked' | 40 | + 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.' |
41 | + signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.' | ||
42 | + signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.' | ||
45 | unlocks: | 43 | unlocks: |
46 | send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.' | 44 | send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.' |
47 | unlocked: 'Your account was successfully unlocked. You are now signed in.' | 45 | unlocked: 'Your account was successfully unlocked. You are now signed in.' |
db/migrate/20110913200833_devise_create_users.rb
1 | class DeviseCreateUsers < ActiveRecord::Migration | 1 | class DeviseCreateUsers < ActiveRecord::Migration |
2 | def self.up | 2 | def self.up |
3 | create_table(:users) do |t| | 3 | create_table(:users) do |t| |
4 | - t.database_authenticatable :null => false | ||
5 | - t.recoverable | ||
6 | - t.rememberable | ||
7 | - t.trackable | 4 | + ## Database authenticatable |
5 | + t.string :email, :null => false, :default => "" | ||
6 | + t.string :encrypted_password, :null => false, :default => "" | ||
8 | 7 | ||
9 | - # t.encryptable | ||
10 | - # t.confirmable | ||
11 | - # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both | ||
12 | - # t.token_authenticatable | 8 | + ## Recoverable |
9 | + t.string :reset_password_token | ||
10 | + t.datetime :reset_password_sent_at | ||
11 | + | ||
12 | + ## Rememberable | ||
13 | + t.datetime :remember_created_at | ||
14 | + | ||
15 | + ## Trackable | ||
16 | + t.integer :sign_in_count, :default => 0 | ||
17 | + t.datetime :current_sign_in_at | ||
18 | + t.datetime :last_sign_in_at | ||
19 | + t.string :current_sign_in_ip | ||
20 | + t.string :last_sign_in_ip | ||
21 | + | ||
22 | + ## Encryptable | ||
23 | + # t.string :password_salt | ||
24 | + | ||
25 | + ## Confirmable | ||
26 | + # t.string :confirmation_token | ||
27 | + # t.datetime :confirmed_at | ||
28 | + # t.datetime :confirmation_sent_at | ||
29 | + # t.string :unconfirmed_email # Only if using reconfirmable | ||
30 | + | ||
31 | + ## Lockable | ||
32 | + # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts | ||
33 | + # t.string :unlock_token # Only if unlock strategy is :email or :both | ||
34 | + # t.datetime :locked_at | ||
35 | + | ||
36 | + # Token authenticatable | ||
37 | + # t.string :authentication_token | ||
38 | + | ||
39 | + ## Invitable | ||
40 | + # t.string :invitation_token | ||
13 | 41 | ||
14 | t.timestamps | 42 | t.timestamps |
15 | end | 43 | end |
@@ -18,7 +46,7 @@ class DeviseCreateUsers < ActiveRecord::Migration | @@ -18,7 +46,7 @@ class DeviseCreateUsers < ActiveRecord::Migration | ||
18 | add_index :users, :reset_password_token, :unique => true | 46 | add_index :users, :reset_password_token, :unique => true |
19 | # add_index :users, :confirmation_token, :unique => true | 47 | # add_index :users, :confirmation_token, :unique => true |
20 | # add_index :users, :unlock_token, :unique => true | 48 | # add_index :users, :unlock_token, :unique => true |
21 | - # add_index :users, :authentication_token, :unique => true | 49 | + add_index :users, :authentication_token, :unique => true |
22 | end | 50 | end |
23 | 51 | ||
24 | def self.down | 52 | def self.down |