Skip to content

Commit f4c04fe

Browse files
committed
Merge branch 'develop' of github.com:tansengming/rails-base into feature/daily-cred
Conflicts: changelog
2 parents bf04cf5 + cbbf767 commit f4c04fe

File tree

12 files changed

+181
-75
lines changed

12 files changed

+181
-75
lines changed

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ rails_best_practices_output.html
99
# git config --global core.excludesfile ~/.gitignore_global
1010

1111
# Ignore bundler config
12-
/.bundle
12+
.bundle
1313

1414
# Ignore the default SQLite database.
15-
/db/*.sqlite3
15+
db/*.sqlite3
1616

1717
# Ignore all logfiles and tempfiles.
18-
/log/*.log
19-
/tmp
18+
log/*.log
19+
tmp

Gemfile

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
source 'https://rubygems.org'
2-
ruby "1.9.3"
2+
ruby "2.0.0"
33

44
gem 'rails', '3.2.13'
55
gem 'pg'
@@ -12,23 +12,33 @@ gem 'therubyracer'
1212
gem "simple_form"
1313
gem 'unicorn'
1414
gem 'foreman'
15-
gem 'mailcatcher'
1615
gem 'newrelic_rpm'
1716

18-
group :development, :test do
19-
gem 'kumade'
17+
group :test do
2018
gem 'rspec-rails'
2119
gem 'factory_girl_rails'
20+
gem 'steak'
21+
gem 'fuubar'
22+
end
23+
24+
group :development do
25+
gem 'mailcatcher'
2226
gem 'heroku'
2327
gem 'rails_best_practices'
2428
gem 'reek'
2529
gem 'bullet'
26-
gem 'steak'
27-
gem 'fuubar'
28-
gem 'zeus'
2930
gem 'meta_request'
3031
gem 'better_errors'
3132
gem 'binding_of_caller'
33+
gem 'kumade'
34+
gem 'zeus'
35+
gem 'wirble'
36+
# gem 'debugger'
37+
end
38+
39+
group :development, :test do
40+
gem "awesome_print", :require => "ap"
41+
gem 'tapp'
3242
end
3343

3444
group :assets do

Gemfile.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ GEM
274274
steak (2.0.0)
275275
capybara (>= 1.0.0)
276276
rspec-rails (>= 2.5.0)
277+
tapp (1.4.0)
278+
thor
277279
therubyracer (0.11.4)
278280
libv8 (~> 3.11.8.12)
279281
ref
@@ -302,6 +304,7 @@ GEM
302304
warden (1.2.1)
303305
rack (>= 1.0)
304306
websocket (1.0.7)
307+
wirble (0.1.3)
305308
xpath (1.0.0)
306309
nokogiri (~> 1.3)
307310
zeus (0.13.3)
@@ -312,6 +315,7 @@ PLATFORMS
312315

313316
DEPENDENCIES
314317
activeadmin
318+
awesome_print
315319
better_errors
316320
binding_of_caller
317321
bullet
@@ -334,8 +338,10 @@ DEPENDENCIES
334338
sass-rails
335339
simple_form
336340
steak
341+
tapp
337342
therubyracer
338343
twitter-bootstrap-rails
339344
uglifier
340345
unicorn
346+
wirble
341347
zeus

changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
current
22
- adds support for daily cred
3+
- specs for super admin login
4+
5+
2013-03-28
6+
=======
7+
8+
- fix deprecations

config/environments/development.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
# Don't care if the mailer can't send
1717
config.action_mailer.raise_delivery_errors = false
18+
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
1819

1920
# Print deprecation notices to the Rails logger
2021
config.active_support.deprecation = :log
@@ -40,6 +41,5 @@
4041
Bullet.alert = true
4142
Bullet.bullet_logger = true
4243
Bullet.console = true
43-
Bullet.disable_browser_cache = true
4444
end
4545
end

config/initializers/devise.rb

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
# Configure the class responsible to send e-mails.
1010
# config.mailer = "Devise::Mailer"
1111

12-
# Automatically apply schema changes in tableless databases
13-
config.apply_schema = false
14-
1512
# ==> ORM configuration
1613
# Load and configure the ORM. Supports :active_record (default) and
1714
# :mongoid (bson_ext recommended) by default. Other ORMs may be
@@ -85,7 +82,7 @@
8582
config.stretches = Rails.env.test? ? 1 : 10
8683

8784
# Setup a pepper to generate the encrypted password.
88-
# config.pepper = "4e48652f47c0d3b37d43527a41712f00afcaf20288fd8afe3dffc9d2fa0bdedc1dcf6d3907c70f2363cc797f0ac61e52b2aa2cd178927356c583d27cad132467"
85+
# config.pepper = "a5cb31200deaddaa9bab770991a52347670164f755524e82c4cfe467e00bf9e33ebeb4166833bdba2d96acf3b7945fbfaee2440293e7dc5f0cf736562dac8664"
8986

9087
# ==> Configuration for :confirmable
9188
# A period that the user is allowed to access the website even without
@@ -95,7 +92,15 @@
9592
# the user cannot access the website without confirming his account.
9693
# config.allow_unconfirmed_access_for = 2.days
9794

98-
# If true, requires any email changes to be confirmed (exctly the same way as
95+
# A period that the user is allowed to confirm their account before their
96+
# token becomes invalid. For example, if set to 3.days, the user can confirm
97+
# their account within 3 days after the mail was sent, but on the fourth day
98+
# their account can't be confirmed with the token any more.
99+
# Default is nil, meaning there is no restriction on how long a user can take
100+
# before confirming their account.
101+
# config.confirm_within = 3.days
102+
103+
# If true, requires any email changes to be confirmed (exactly the same way as
99104
# initial account confirmation) to be applied. Requires additional unconfirmed_email
100105
# db field (see migrations). Until confirmed new email is stored in
101106
# unconfirmed email column, and copied to email column on successful confirmation.
@@ -111,17 +116,13 @@
111116
# If true, extends the user's remember period when remembered via cookie.
112117
# config.extend_remember_period = false
113118

114-
# If true, uses the password salt as remember token. This should be turned
115-
# to false if you are not using database authenticatable.
116-
config.use_salt_as_remember_token = true
117-
118119
# Options to be passed to the created cookie. For instance, you can set
119120
# :secure => true in order to force SSL only cookies.
120-
# config.cookie_options = {}
121+
# config.rememberable_options = {}
121122

122123
# ==> Configuration for :validatable
123-
# Range for password length. Default is 6..128.
124-
# config.password_length = 6..128
124+
# Range for password length. Default is 8..128.
125+
config.password_length = 8..128
125126

126127
# Email regex used to validate email formats. It simply asserts that
127128
# an one (and only one) @ exists in the given string. This is mainly
@@ -133,6 +134,9 @@
133134
# time the user will be asked for credentials again. Default is 30 minutes.
134135
# config.timeout_in = 30.minutes
135136

137+
# If true, expires auth token on session timeout.
138+
# config.expire_auth_token_on_timeout = false
139+
136140
# ==> Configuration for :lockable
137141
# Defines which strategy will be used to lock an account.
138142
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
@@ -188,9 +192,8 @@
188192
# devise role declared in your routes (usually :user).
189193
# config.default_scope = :user
190194

191-
# Configure sign_out behavior.
192-
# Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
193-
# The default is true, which means any logout action will sign out all active scopes.
195+
# Set this configuration to false if you want /users/sign_out to sign out
196+
# only the current scope. By default, Devise signs out all scopes.
194197
# config.sign_out_all_scopes = true
195198

196199
# ==> Navigation configuration
@@ -220,4 +223,18 @@
220223
# manager.intercept_401 = false
221224
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
222225
# end
226+
227+
# ==> Mountable engine configurations
228+
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
229+
# is mountable, there are some extra configurations to be taken into account.
230+
# The following options are available, assuming the engine is mounted as:
231+
#
232+
# mount MyEngine, at: "/my_engine"
233+
#
234+
# The router that invoked `devise_for`, in the example above, would be:
235+
# config.router_name = :my_engine
236+
#
237+
# When using omniauth, Devise cannot automatically set Omniauth path,
238+
# so you need to do it manually. For the users scope, it would be:
239+
# config.omniauth_path_prefix = "/my_engine/users/auth"
223240
end

config/locales/devise.en.yml

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,59 @@
11
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
22

33
en:
4+
devise:
5+
confirmations:
6+
confirmed: "Your account was successfully confirmed. You are now signed in."
7+
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
8+
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."
9+
failure:
10+
already_authenticated: "You are already signed in."
11+
inactive: "Your account was not activated yet."
12+
invalid: "Invalid email or password."
13+
invalid_token: "Invalid authentication token."
14+
locked: "Your account is locked."
15+
not_found_in_database: "Invalid email or password."
16+
timeout: "Your session expired, please sign in again to continue."
17+
unauthenticated: "You need to sign in or sign up before continuing."
18+
unconfirmed: "You have to confirm your account before continuing."
19+
mailer:
20+
confirmation_instructions:
21+
subject: "Confirmation instructions"
22+
reset_password_instructions:
23+
subject: "Reset password instructions"
24+
unlock_instructions:
25+
subject: "Unlock Instructions"
26+
omniauth_callbacks:
27+
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28+
success: "Successfully authenticated from %{kind} account."
29+
passwords:
30+
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."
31+
send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes."
32+
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."
33+
updated: "Your password was changed successfully. You are now signed in."
34+
updated_not_active: "Your password was changed successfully."
35+
registrations:
36+
destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
37+
signed_up: "Welcome! You have signed up successfully."
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."
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+
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."
42+
updated: "You updated your account successfully."
43+
sessions:
44+
signed_in: "Signed in successfully."
45+
signed_out: "Signed out successfully."
46+
unlocks:
47+
send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
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+
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
450
errors:
551
messages:
52+
already_confirmed: "was already confirmed, please try signing in"
53+
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
654
expired: "has expired, please request a new one"
755
not_found: "not found"
8-
already_confirmed: "was already confirmed, please try signing in"
956
not_locked: "was not locked"
1057
not_saved:
1158
one: "1 error prohibited this %{resource} from being saved:"
1259
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 e-mail exists on our database, you will receive a password recovery link on your e-mail"
32-
confirmations:
33-
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
34-
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.'
35-
confirmed: 'Your account was successfully confirmed. You are now signed in.'
36-
registrations:
37-
signed_up: 'Welcome! You have signed up successfully.'
38-
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.'
39-
signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
40-
signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
41-
updated: 'You updated your account successfully.'
42-
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."
43-
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
44-
unlocks:
45-
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
46-
unlocked: 'Your account has been unlocked successfully. Please sign in to continue.'
47-
send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
48-
omniauth_callbacks:
49-
success: 'Successfully authorized from %{kind} account.'
50-
failure: 'Could not authorize you from %{kind} because "%{reason}".'
51-
mailer:
52-
confirmation_instructions:
53-
subject: 'Confirmation instructions'
54-
reset_password_instructions:
55-
subject: 'Reset password instructions'
56-
unlock_instructions:
57-
subject: 'Unlock Instructions'

custom_plan.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require 'zeus/rails'
2+
3+
class CustomPlan < Zeus::Rails
4+
5+
# def my_custom_command
6+
# # see https://github.com/burke/zeus/blob/master/docs/ruby/modifying.md
7+
# end
8+
9+
end
10+
11+
Zeus.plan = CustomPlan.new

spec/acceptance/admin_walk_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
} do
66

77
background do
8-
admin = create(:admin_user, :password => '123456')
8+
admin = create(:admin_user, :password => '12345678')
99
AdminUser.count.should == 1
1010

1111
visit "/admin"
1212
fill_in 'admin_user_email', :with => admin.email
13-
fill_in 'admin_user_password', :with => '123456'
13+
fill_in 'admin_user_password', :with => '12345678'
1414
click_button 'Login'
1515

1616
current_path.should == '/admin'
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
require 'acceptance/acceptance_helper'
2+
3+
feature 'Super Admin walk', %q{
4+
just a walk through active admin to make sure nothing breaks from all the customizations we've made
5+
} do
6+
7+
background do
8+
admin = create(:admin_user, email: '[email protected]', password: '12345678')
9+
super_admin = create(:super_admin, password: 'super12345678')
10+
AdminUser.count.should == 1
11+
12+
visit "/super_admins"
13+
fill_in 'super_admin_email', :with => super_admin.email
14+
fill_in 'super_admin_password', :with => 'super12345678'
15+
click_button 'Login'
16+
17+
current_path.should == '/super_admins'
18+
end
19+
20+
scenario 'walk on all indexes and new forms' do
21+
click_link 'Admin Users'
22+
page.should have_content('[email protected]')
23+
click_link 'New Admin User'
24+
25+
click_link 'Logout'
26+
end
27+
end

0 commit comments

Comments
 (0)