Skip to content

Commit a2eb88c

Browse files
committed
Upgrade devise to 2.2.2, closes #141
1 parent c5c498a commit a2eb88c

6 files changed

Lines changed: 40 additions & 37 deletions

File tree

Gemfile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,27 @@ gem 'bson_ext'
1313
# Gems used only for assets and not required
1414
# in production environments by default.
1515
group :assets do
16-
gem 'sass-rails', " ~> 3.1.0"
16+
gem 'sass-rails', "~> 3.1.0"
1717
gem 'coffee-rails', "~> 3.1.0"
1818
gem 'uglifier'
1919
end
2020

21-
gem 'jnunemaker-validatable', '>= 1.8.4' # Required by mm-devise
22-
gem 'devise', '>= 1.2'
23-
gem 'mm-devise', '>= 1.2'
21+
gem "devise", "~> 2.2.2"
22+
gem 'mm-devise', '~> 2.0'
2423
gem 'cancan'
2524

2625
gem 'inherited_resources'
27-
gem 'simple_form', :git => "https://github.com/bitzesty/bootstrap_form.git"
28-
gem "semantic_menu", :git => "git://github.com/michaek/semantic_menu.git"
26+
gem 'simple_form', git: "https://github.com/bitzesty/bootstrap_form.git"
27+
gem "semantic_menu", git: "git://github.com/michaek/semantic_menu.git"
2928

3029
gem 'will_paginate' # Pagination
3130
gem 'rdiscount' # Markdown
3231

33-
3432
group :development do
3533
# Use unicorn as the web server
3634
gem 'unicorn'
3735
end
3836

39-
4037
group :development, :test do
4138
gem 'fabrication'
4239
gem 'rspec-rails'

Gemfile.lock

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,11 @@ GEM
7979
cucumber (>= 1.1.3)
8080
nokogiri (>= 1.5.0)
8181
database_cleaner (0.7.1)
82-
devise (1.5.3)
82+
devise (2.2.2)
8383
bcrypt-ruby (~> 3.0)
84-
orm_adapter (~> 0.0.3)
85-
warden (~> 1.1)
84+
orm_adapter (~> 0.1)
85+
railties (~> 3.1)
86+
warden (~> 1.2.1)
8687
diff-lcs (1.1.3)
8788
erubis (2.7.0)
8889
execjs (1.3.0)
@@ -107,8 +108,6 @@ GEM
107108
inherited_resources (1.3.0)
108109
has_scope (~> 0.5.0)
109110
responders (~> 0.6.0)
110-
jnunemaker-validatable (1.8.4)
111-
activesupport (>= 2.3.4)
112111
jquery-rails (1.0.19)
113112
railties (~> 3.0)
114113
thor (~> 0.14)
@@ -125,7 +124,7 @@ GEM
125124
redcarpet
126125
method_source (0.7.0)
127126
mime-types (1.19)
128-
mm-devise (1.3)
127+
mm-devise (2.0)
129128
devise (>= 1.2)
130129
mongo_mapper (>= 0.9.0)
131130
mocha (0.10.3)
@@ -138,7 +137,7 @@ GEM
138137
plucky (~> 0.4.0)
139138
multi_json (1.0.4)
140139
nokogiri (1.5.0)
141-
orm_adapter (0.0.6)
140+
orm_adapter (0.4.0)
142141
pg (0.12.2)
143142
plucky (0.4.4)
144143
mongo (~> 1.5)
@@ -147,7 +146,7 @@ GEM
147146
coderay (~> 1.0.5)
148147
method_source (~> 0.7)
149148
slop (>= 2.4.3, < 3)
150-
rack (1.3.8)
149+
rack (1.3.9)
151150
rack-cache (1.2)
152151
rack (>= 0.4)
153152
rack-mount (0.8.3)
@@ -223,7 +222,7 @@ GEM
223222
kgio (~> 2.4)
224223
rack
225224
raindrops (~> 0.6)
226-
warden (1.1.0)
225+
warden (1.2.1)
227226
rack (>= 1.0)
228227
will_paginate (3.0.2)
229228
xpath (0.1.4)
@@ -238,17 +237,16 @@ DEPENDENCIES
238237
coffee-rails (~> 3.1.0)
239238
cucumber-rails
240239
database_cleaner
241-
devise (>= 1.2)
240+
devise (~> 2.2.2)
242241
fabrication
243242
faker
244243
hackety_hack-lessons (~> 1.1)
245244
haml-rails
246245
inherited_resources
247-
jnunemaker-validatable (>= 1.8.4)
248246
jquery-rails
249247
json
250248
launchy
251-
mm-devise (>= 1.2)
249+
mm-devise (~> 2.0)
252250
mocha
253251
mongo_mapper
254252
pg

app/models/user.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,24 @@ class User
1111
key :moderator, Boolean
1212
key :blog_poster, Boolean
1313

14+
## Database authenticatable
15+
key :email, :type => String, :null => false
16+
key :encrypted_password, :type => String, :null => false
17+
18+
## Recoverable
19+
key :reset_password_token, :type => String
20+
key :reset_password_sent_at, :type => Time
21+
22+
## Rememberable
23+
key :remember_created_at, :type => Time
24+
25+
## Trackable
26+
key :sign_in_count, :type => Integer
27+
key :current_sign_in_at, :type => Time
28+
key :last_sign_in_at, :type => Time
29+
key :current_sign_in_ip, :type => String
30+
key :last_sign_in_ip, :type => String
31+
1432
many :questions
1533
many :answers
1634

config/initializers/devise.rb

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
# You can use this to let your user access some features of your application
7474
# without confirming the account, but blocking it after a certain period
7575
# (ie 2 days).
76-
# config.confirm_within = 2.days
76+
# config.allow_unconfirmed_access_for = 2.days
7777

7878
# Defines which key will be used when confirming an account
7979
# config.confirmation_keys = [ :email ]
@@ -82,16 +82,9 @@
8282
# The time the user will be remembered without asking for credentials again.
8383
# config.remember_for = 2.weeks
8484

85-
# If true, a valid remember token can be re-used between multiple browsers.
86-
# config.remember_across_browsers = true
87-
8885
# If true, extends the user's remember period when remembered via cookie.
8986
# config.extend_remember_period = false
9087

91-
# If true, uses the password salt as remember token. This should be turned
92-
# to false if you are not using database authenticatable.
93-
config.use_salt_as_remember_token = true
94-
9588
# Options to be passed to the created cookie. For instance, you can set
9689
# :secure => true in order to force SSL only cookies.
9790
# config.cookie_options = {}
@@ -153,10 +146,6 @@
153146
# Defines name of the authentication token params key
154147
# config.token_authentication_key = :auth_token
155148

156-
# If true, authentication through token does not store user in session and needs
157-
# to be supplied on each request. Useful if you are using the token as API token.
158-
# config.stateless_token = false
159-
160149
# ==> Scopes configuration
161150
# Turn scoped views on. Before rendering "sessions/new", it will first check for
162151
# "users/sessions/new". It's turned off by default because it's slower if you

config/locales/devise.en.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ en:
1717
unauthenticated: 'You need to sign in or sign up before continuing.'
1818
unconfirmed: 'You have to confirm your account before continuing.'
1919
locked: 'Your account is locked.'
20+
not_found_in_database: 'Invalid email or password.'
2021
invalid: 'Invalid email or password.'
2122
invalid_token: 'Invalid authentication token.'
2223
timeout: 'Your session expired, please sign in again to continue.'
@@ -33,10 +34,9 @@ en:
3334
send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
3435
confirmed: 'Your account was successfully confirmed. You are now signed in.'
3536
registrations:
36-
signed_up: 'Welcome! You have signed up successfully.'
37-
inactive_signed_up: 'You have signed up successfully. However, we could not sign you in because your account is %{reason}.'
38-
updated: 'You updated your account successfully.'
39-
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
37+
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.'
38+
signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
39+
signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
4040
unlocks:
4141
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
4242
unlocked: 'Your account was successfully unlocked. You are now signed in.'

config/routes.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131

3232
resources :programs, :only => [:index, :show]
3333

34-
devise_for :users do
34+
devise_for :users
35+
devise_scope :user do
3536
get "login" => "devise/sessions#new", :as => "login"
3637
get "logout" => "devise/sessions#destroy", :as => "logout"
3738
end

0 commit comments

Comments
 (0)