Skip to content

Commit 8bc3d5c

Browse files
committed
添加devise的配置说明,修改了devise生成的字段描述。
1 parent 98d57ba commit 8bc3d5c

28 files changed

Lines changed: 566 additions & 152 deletions

.DS_Store

8 KB
Binary file not shown.

Gemfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ gem 'figaro'
8484

8585
# 前端ui框架bootstrap
8686
gem 'bootstrap', '~> 4.3.0'
87+
# gem 'webpacker'
8788

8889
# 更简单更强大的表单创建。
8990
# gem 'simple_form', '~> 4.0.0'
@@ -109,6 +110,8 @@ gem 'grape'
109110
# gem 'elastic-apm'
110111
# gem "elasticsearch-model"
111112
# gem "elasticsearch-rails"
113+
#
114+
# gem 'searchkick'
112115

113116
# 可以为我们的应用加入操作权限控制。
114117
gem "pundit"
@@ -118,6 +121,7 @@ gem "pundit"
118121
# 三方平台 OAuth 验证登陆
119122
gem "omniauth"
120123
gem "omniauth-github"
124+
gem "omniauth-wechat-oauth2"
121125

122126
# 邮件服务
123127
# gem "postmark"
@@ -143,6 +147,20 @@ gem "devise-encryptable"
143147
# 赞、关注、收藏、屏蔽等功能的数据结构
144148
# gem "action-store"
145149

150+
# 后台管理
151+
# gem 'activeadmin'
152+
# 后台管理的前端UI
153+
# gem 'arctic_admin'
154+
155+
# 管理配置信息的库。
156+
# gem "rails-settings-cached", "~> 2.0"
157+
158+
# 一个使用 Ruby 连接和操作 RabbitMQ 的客户端
159+
# gem "bunny", ">= 2.14.1"
160+
# 业务通过 Bunny 在 Rails 中简易、快速地生产发布了消息,就需要有消费者来接收和消费消息,Sneakers 是一个处理 RabbitMQ 消息队列的高性能 Ruby 框架
161+
# gem 'sneakers'
162+
163+
146164
group :development, :test do
147165
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
148166
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
@@ -248,6 +266,9 @@ group :test do
248266

249267
# 生成虚假数据
250268
gem "faker"
269+
270+
# 代码覆盖率工具。产生精美的报告。
271+
gem 'simplecov', require: false
251272
end
252273

253274
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem

Gemfile.lock

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ GEM
152152
devise-encryptable (0.2.0)
153153
devise (>= 2.1.0)
154154
diff-lcs (1.3)
155+
docile (1.3.2)
155156
dry-configurable (0.11.4)
156157
concurrent-ruby (~> 1.0)
157158
dry-core (~> 0.4, >= 0.4.7)
@@ -221,18 +222,6 @@ GEM
221222
activesupport (>= 4.2.0)
222223
json (2.2.0)
223224
jwt (2.2.1)
224-
kaminari (1.2.0)
225-
activesupport (>= 4.1.0)
226-
kaminari-actionview (= 1.2.0)
227-
kaminari-activerecord (= 1.2.0)
228-
kaminari-core (= 1.2.0)
229-
kaminari-actionview (1.2.0)
230-
actionview
231-
kaminari-core (= 1.2.0)
232-
kaminari-activerecord (1.2.0)
233-
activerecord
234-
kaminari-core (= 1.2.0)
235-
kaminari-core (1.2.0)
236225
kwalify (0.7.2)
237226
launchy (2.4.3)
238227
addressable (~> 2.3)
@@ -274,9 +263,6 @@ GEM
274263
nio4r (2.3.1)
275264
nokogiri (1.10.3)
276265
mini_portile2 (~> 2.4.0)
277-
notifications (0.6.1)
278-
kaminari (>= 0.15)
279-
rails (>= 5)
280266
oauth2 (1.4.4)
281267
faraday (>= 0.8, < 2.0)
282268
jwt (>= 1.0, < 3.0)
@@ -292,6 +278,9 @@ GEM
292278
omniauth-oauth2 (1.6.0)
293279
oauth2 (~> 1.1)
294280
omniauth (~> 1.9)
281+
omniauth-wechat-oauth2 (0.1.2)
282+
omniauth (>= 1.3.2)
283+
omniauth-oauth2 (>= 1.1.1)
295284
orm_adapter (0.5.0)
296285
parallel (1.17.0)
297286
parser (2.6.3.0)
@@ -431,8 +420,6 @@ GEM
431420
rubocop-rspec (1.30.0)
432421
rubocop (>= 0.58.0)
433422
ruby-progressbar (1.10.0)
434-
ruby-push-notifications (1.3.0)
435-
builder (~> 3.0)
436423
ruby2_keywords (0.0.2)
437424
ruby_dep (1.5.0)
438425
ruby_parser (3.13.1)
@@ -484,6 +471,10 @@ GEM
484471
rack (>= 1.5.0)
485472
rack-protection (>= 1.5.0)
486473
redis (>= 3.3.5, < 5)
474+
simplecov (0.18.5)
475+
docile (~> 1.1)
476+
simplecov-html (~> 0.11)
477+
simplecov-html (0.12.2)
487478
slop (3.6.0)
488479
spring (2.0.2)
489480
activesupport (>= 4.2)
@@ -585,9 +576,9 @@ DEPENDENCIES
585576
listen (>= 3.0.5, < 3.2)
586577
meta_request
587578
mysql2
588-
notifications
589579
omniauth
590580
omniauth-github
581+
omniauth-wechat-oauth2
591582
pry
592583
pry-byebug
593584
pry-rails
@@ -609,13 +600,13 @@ DEPENDENCIES
609600
rspec-support
610601
rubocop (~> 0.58.2)
611602
rubocop-rspec (~> 1.29)
612-
ruby-push-notifications
613603
rubycritic
614604
rvm1-capistrano3
615605
sass-rails (~> 5.0)
616606
seed-fu
617607
selenium-webdriver
618608
sidekiq
609+
simplecov
619610
spring
620611
spring-watcher-listen (~> 2.0.0)
621612
sprockets (~> 3.0)
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
class ApplicationController < ActionController::Base
2-
protect_from_forgery prepend: true
2+
protect_from_forgery with: :exception
3+
before_action :authenticate_user!
34

45
end
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# frozen_string_literal: true
2+
3+
class Users::ConfirmationsController < Devise::ConfirmationsController
4+
# GET /resource/confirmation/new
5+
# def new
6+
# super
7+
# end
8+
9+
# POST /resource/confirmation
10+
# def create
11+
# super
12+
# end
13+
14+
# GET /resource/confirmation?confirmation_token=abcdef
15+
# def show
16+
# super
17+
# end
18+
19+
# protected
20+
21+
# The path used after resending confirmation instructions.
22+
# def after_resending_confirmation_instructions_path_for(resource_name)
23+
# super(resource_name)
24+
# end
25+
26+
# The path used after confirmation.
27+
# def after_confirmation_path_for(resource_name, resource)
28+
# super(resource_name, resource)
29+
# end
30+
end
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# frozen_string_literal: true
2+
3+
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
4+
# You should configure your model like this:
5+
# devise :omniauthable, omniauth_providers: [:twitter]
6+
7+
# You should also create an action method in this controller like this:
8+
# def twitter
9+
# end
10+
11+
# More info at:
12+
# https://github.com/plataformatec/devise#omniauth
13+
14+
# GET|POST /resource/auth/twitter
15+
# def passthru
16+
# super
17+
# end
18+
19+
# GET|POST /users/auth/twitter/callback
20+
# def failure
21+
# super
22+
# end
23+
24+
# protected
25+
26+
# The path used when OmniAuth fails
27+
# def after_omniauth_failure_path_for(scope)
28+
# super(scope)
29+
# end
30+
end
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# frozen_string_literal: true
2+
3+
class Users::PasswordsController < Devise::PasswordsController
4+
# GET /resource/password/new
5+
# def new
6+
# super
7+
# end
8+
9+
# POST /resource/password
10+
# def create
11+
# super
12+
# end
13+
14+
# GET /resource/password/edit?reset_password_token=abcdef
15+
# def edit
16+
# super
17+
# end
18+
19+
# PUT /resource/password
20+
# def update
21+
# super
22+
# end
23+
24+
# protected
25+
26+
# def after_resetting_password_path_for(resource)
27+
# super(resource)
28+
# end
29+
30+
# The path used after sending reset password instructions
31+
# def after_sending_reset_password_instructions_path_for(resource_name)
32+
# super(resource_name)
33+
# end
34+
end
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# frozen_string_literal: true
2+
3+
class Users::RegistrationsController < Devise::RegistrationsController
4+
# before_action :configure_sign_up_params, only: [:create]
5+
# before_action :configure_account_update_params, only: [:update]
6+
7+
# GET /resource/sign_up
8+
# def new
9+
# super
10+
# end
11+
12+
# POST /resource
13+
# def create
14+
# super
15+
# end
16+
17+
# GET /resource/edit
18+
# def edit
19+
# super
20+
# end
21+
22+
# PUT /resource
23+
# def update
24+
# super
25+
# end
26+
27+
# DELETE /resource
28+
# def destroy
29+
# super
30+
# end
31+
32+
# GET /resource/cancel
33+
# Forces the session data which is usually expired after sign
34+
# in to be expired now. This is useful if the user wants to
35+
# cancel oauth signing in/up in the middle of the process,
36+
# removing all OAuth session data.
37+
# def cancel
38+
# super
39+
# end
40+
41+
# protected
42+
43+
# If you have extra params to permit, append them to the sanitizer.
44+
# def configure_sign_up_params
45+
# devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
46+
# end
47+
48+
# If you have extra params to permit, append them to the sanitizer.
49+
# def configure_account_update_params
50+
# devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
51+
# end
52+
53+
# The path used after sign up.
54+
# def after_sign_up_path_for(resource)
55+
# super(resource)
56+
# end
57+
58+
# The path used after sign up for inactive accounts.
59+
# def after_inactive_sign_up_path_for(resource)
60+
# super(resource)
61+
# end
62+
end
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# frozen_string_literal: true
2+
3+
class Users::SessionsController < Devise::SessionsController
4+
# before_action :configure_sign_in_params, only: [:create]
5+
6+
# GET /resource/sign_in
7+
# def new
8+
# super
9+
# end
10+
11+
# POST /resource/sign_in
12+
# def create
13+
# super
14+
# end
15+
16+
# DELETE /resource/sign_out
17+
# def destroy
18+
# super
19+
# end
20+
21+
# protected
22+
23+
# If you have extra params to permit, append them to the sanitizer.
24+
# def configure_sign_in_params
25+
# devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])
26+
# end
27+
end
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# frozen_string_literal: true
2+
3+
class Users::UnlocksController < Devise::UnlocksController
4+
# GET /resource/unlock/new
5+
# def new
6+
# super
7+
# end
8+
9+
# POST /resource/unlock
10+
# def create
11+
# super
12+
# end
13+
14+
# GET /resource/unlock?unlock_token=abcdef
15+
# def show
16+
# super
17+
# end
18+
19+
# protected
20+
21+
# The path used after sending unlock password instructions
22+
# def after_sending_unlock_instructions_path_for(resource)
23+
# super(resource)
24+
# end
25+
26+
# The path used after unlocking the resource
27+
# def after_unlock_path_for(resource)
28+
# super(resource)
29+
# end
30+
end

0 commit comments

Comments
 (0)