Commit 64bbbc2 1 parent deb1840 commit 64bbbc2 Copy full SHA for 64bbbc2
File tree 3 files changed +32
-2
lines changed
lib/generators/sudo_rails
3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,8 @@ SudoRails.setup do |config|
73
73
end
74
74
```
75
75
76
+ Use the provided ` sudo_rails:config ` generator to create a default config file under your * initializers* folder.
77
+
76
78
### Sudo sessions
77
79
78
80
Using the ` sudo_session_duration ` option you are able to configure the ` sudo ` session duration (30 minutes by default).
Original file line number Diff line number Diff line change
1
+ class SudoRails ::ConfigGenerator < Rails ::Generators ::Base
2
+ def create_config_file
3
+ create_file "config/initializers/sudo_rails.rb" , <<~RUBY
4
+ SudoRails.setup do |config|
5
+ ### On/off engine
6
+ # config.enabled = true
7
+
8
+ ### Sudo mode sessions duration, default is 30 minutes
9
+ # config.sudo_session_duration = 10.minutes
10
+
11
+ ### Confirmation page styling
12
+ # config.custom_logo = '/images/logo_medium.png'
13
+ # config.primary_color = '#1a7191'
14
+ # config.background_color = '#1a1a1a'
15
+ # config.layout = 'admin'
16
+
17
+ ### Confirmation strategy implementation
18
+ # config.confirm_strategy = -> (context, password) {
19
+ # user = context.current_user
20
+ # user.valid_password?(password)
21
+ # }
22
+
23
+ ### Reset password link
24
+ # config.reset_pass_link = '/users/password/new'
25
+ end
26
+ RUBY
27
+ end
28
+ end
Original file line number Diff line number Diff line change 1
1
class SudoRails ::ViewGenerator < Rails ::Generators ::Base
2
2
source_root File . expand_path ( "../../../app/views/sudo_rails/" , __dir__ )
3
3
4
- def copy_initializer_file
4
+ def copy_view_file
5
5
copy_file "confirm_form.html.erb" , "app/views/sudo_rails/confirm_form.html.erb"
6
6
end
7
- end
7
+ end
You can’t perform that action at this time.
0 commit comments