protected 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +151 -0
  3. data/Rakefile +32 -0
  4. data/app/assets/images/protected/Sorting icons.psd +0 -0
  5. data/app/assets/images/protected/back_disabled.png +0 -0
  6. data/app/assets/images/protected/back_enabled.png +0 -0
  7. data/app/assets/images/protected/back_enabled_hover.png +0 -0
  8. data/app/assets/images/protected/favicon.ico +0 -0
  9. data/app/assets/images/protected/forward_disabled.png +0 -0
  10. data/app/assets/images/protected/forward_enabled.png +0 -0
  11. data/app/assets/images/protected/forward_enabled_hover.png +0 -0
  12. data/app/assets/images/protected/glyphicons-halflings-white.png +0 -0
  13. data/app/assets/images/protected/glyphicons-halflings.png +0 -0
  14. data/app/assets/images/protected/sort_asc.png +0 -0
  15. data/app/assets/images/protected/sort_asc_disabled.png +0 -0
  16. data/app/assets/images/protected/sort_both.png +0 -0
  17. data/app/assets/images/protected/sort_desc.png +0 -0
  18. data/app/assets/images/protected/sort_desc_disabled.png +0 -0
  19. data/app/assets/javascripts/protected/application.js +164 -0
  20. data/app/assets/javascripts/protected/bootstrap.min.js +6 -0
  21. data/app/assets/javascripts/protected/jquery.dataTables.min.js +154 -0
  22. data/app/assets/stylesheets/protected/application.css +51 -0
  23. data/app/assets/stylesheets/protected/bootstrap-responsive.min.css +12 -0
  24. data/app/assets/stylesheets/protected/bootstrap.min.css +689 -0
  25. data/app/controllers/protected/admin/protected_controller.rb +14 -0
  26. data/app/controllers/protected/admin/users_controller.rb +70 -0
  27. data/app/controllers/protected/application_controller.rb +18 -0
  28. data/app/controllers/protected/passwords_controller.rb +39 -0
  29. data/app/controllers/protected/sessions_controller.rb +44 -0
  30. data/app/controllers/protected/users_controller.rb +12 -0
  31. data/app/helpers/protected/application_helper.rb +4 -0
  32. data/app/helpers/protected/passwords_helper.rb +21 -0
  33. data/app/mailers/user_mailer.rb +9 -0
  34. data/app/models/protected.rb +5 -0
  35. data/app/models/protected/old_password.rb +18 -0
  36. data/app/models/protected/user.rb +165 -0
  37. data/app/views/layouts/protected/application.html.haml +38 -0
  38. data/app/views/protected/admin/users/_form.html.haml +27 -0
  39. data/app/views/protected/admin/users/_password_fields.html.haml +9 -0
  40. data/app/views/protected/admin/users/_role_fields.html.haml +10 -0
  41. data/app/views/protected/admin/users/confirm_delete.html.haml +9 -0
  42. data/app/views/protected/admin/users/edit.html.haml +9 -0
  43. data/app/views/protected/admin/users/index.html.haml +27 -0
  44. data/app/views/protected/admin/users/new.html.haml +9 -0
  45. data/app/views/protected/admin/users/show.html.haml +0 -0
  46. data/app/views/protected/passwords/edit.html.haml +28 -0
  47. data/app/views/protected/passwords/forgot_password.html.haml +20 -0
  48. data/app/views/protected/passwords/new.html.haml +22 -0
  49. data/app/views/protected/sessions/first_login.html.haml +25 -0
  50. data/app/views/protected/sessions/new.html.haml +22 -0
  51. data/app/views/protected/sessions/not_authorized.html.haml +9 -0
  52. data/app/views/protected/users/_form.html.haml +19 -0
  53. data/app/views/protected/users/edit.html.haml +19 -0
  54. data/app/views/user_mailer/welcome_existing_user.haml +5 -0
  55. data/app/views/user_mailer/welcome_login_instructions.html.haml +6 -0
  56. data/app/views/user_mailer/welcome_password_instructions.haml +7 -0
  57. data/config/initializers/devise.rb +220 -0
  58. data/config/locales/devise.en.yml +62 -0
  59. data/config/routes.rb +34 -0
  60. data/db/migrate/20120418194256_devise_create_add_users.rb +60 -0
  61. data/lib/generators/protected/USAGE +5 -0
  62. data/lib/generators/protected/install/install_generator.rb +26 -0
  63. data/lib/generators/protected/templates/README +32 -0
  64. data/lib/generators/protected/templates/devise.rb +233 -0
  65. data/lib/generators/protected/views/views_generator.rb +40 -0
  66. data/lib/protected.rb +4 -0
  67. data/lib/protected/devise_recoverable_extensions.rb +19 -0
  68. data/lib/protected/engine.rb +10 -0
  69. data/lib/protected/password_utils.rb +46 -0
  70. data/lib/protected/version.rb +3 -0
  71. data/lib/tasks/protected_tasks.rake +44 -0
  72. metadata +414 -0
@@ -0,0 +1,27 @@
1
+ - if @user.errors.any?
2
+ %div{ :class => 'alert-message block-message error', :id => 'error_explanation'}
3
+ %h3== #{pluralize(@user.errors.count, "error")} prohibited this user from being saved:
4
+
5
+ %ul
6
+ - @user.errors.full_messages.each do |msg|
7
+ %li= msg
8
+ %div.control-group
9
+ = f.label :first_name, {:class => 'control-label' }
10
+ %div.controls
11
+ = f.text_field :first_name, :autocomplete => 'off'
12
+ %div.control-group
13
+ = f.label :last_name, {:class => 'control-label' }
14
+ %div.controls
15
+ = f.text_field :last_name, :autocomplete => 'off'
16
+ %div.control-group
17
+ = f.label :company, {:class => 'control-label' }
18
+ %div.controls
19
+ = f.text_field :company, :autocomplete => 'off'
20
+ %div.control-group
21
+ = f.label :login, {:class => 'control-label' }
22
+ %div.controls
23
+ = f.text_field :login, :class => 'logintext', :autocomplete => 'off', :disabled => !@user.new_record?
24
+ %div.control-group
25
+ = f.label :email, {:class => 'control-label' }
26
+ %div.controls
27
+ = f.email_field :email, :class => 'logintext', :autocomplete => 'off', :disabled => !@user.new_record?
@@ -0,0 +1,9 @@
1
+ - if @user.new_record?
2
+ %div{:class => 'clearfix'}
3
+ = f.label :password
4
+ %div{:class => 'input'}
5
+ = f.password_field :password, :class => 'logintext', :autocomplete => 'off'
6
+ %div{:class => 'clearfix'}
7
+ = f.label :password_confirmation
8
+ %div{:class => 'input'}
9
+ = f.password_field :password_confirmation, :class => 'logintext', :autocomplete => 'off'
@@ -0,0 +1,10 @@
1
+ - if f.object != current_user
2
+ %div.control-group
3
+ = f.label "User Role", {:class => 'control-label' }
4
+ %div.controls
5
+ %label.radio
6
+ = f.radio_button :is_admin, false
7
+ Normal User
8
+ %label.radio
9
+ = f.radio_button :is_admin, true
10
+ Admin User
@@ -0,0 +1,9 @@
1
+ %h3 Delete User Account
2
+ %div{:class => "alert-message block-message error" }
3
+ %p
4
+ %strong Be Careful!
5
+ Are you sure you want to delete this user account? It cannot be undone.
6
+ %div{ :class => 'alert-actions' }
7
+ = form_for(['admin',@user], :method => 'DELETE') do |f|
8
+ =f.submit 'Yes, Delete User', :class => 'btn danger'
9
+ =link_to 'Cancel', ['admin','users'], :class =>'btn'
@@ -0,0 +1,9 @@
1
+ = form_for(['admin',@user], :method => 'PUT', :html => { :autocomplete => "off", :class => "form-horizontal" }) do |f|
2
+ %fieldset
3
+ %legend Edit User
4
+ = render :partial => 'form', :locals => { :f => f }
5
+ = render :partial => 'password_fields', :locals => { :f => f }
6
+ = render :partial => 'role_fields', :locals => { :f => f }
7
+ %div.form-actions
8
+ = f.submit 'Save Changes', :class => 'btn btn-primary'
9
+ = link_to 'Cancel', ['admin','users'], :class => 'btn'
@@ -0,0 +1,27 @@
1
+ %h2 Users
2
+ %div.clearfix
3
+ = will_paginate(@users)
4
+ %table.table.table-bordered.table-striped
5
+ %thead
6
+ %tr
7
+ %th Name
8
+ %th Email
9
+ %th Role
10
+ %th Actions
11
+ %tbody
12
+ - @users.each do |u|
13
+ %tr
14
+ %td=u.name
15
+ %td=u.email
16
+ %td=u.is_admin? ? 'Admin' : 'Default'
17
+ %td
18
+ =link_to 'Edit', ['edit','admin',u], :class =>'btn'
19
+ =link_to 'Unlock', ['unlock','admin',u], :class =>'btn' if u != current_user and u.access_locked?
20
+ =link_to 'Delete', ['confirm_delete','admin',u], :class =>'btn btn-danger' unless u == current_user
21
+
22
+ %div.clearfix
23
+ = will_paginate(@users)
24
+
25
+ %div{:class =>'well' }
26
+ =link_to 'New User', ['new','admin','user'], :class => 'btn large primary'
27
+
@@ -0,0 +1,9 @@
1
+ = form_for(['admin',@user], :html => { :autocomplete => "off", :class => "form-horizontal" }) do |f|
2
+ %fieldset
3
+ %legend New User
4
+ = render :partial => 'form', :locals => { :f => f }
5
+ = render :partial => 'role_fields', :locals => { :f => f }
6
+ %div.form-actions
7
+ = f.submit 'Create User', :class => 'btn btn-primary'
8
+ = link_to 'Cancel', ['admin','users'], :class => 'btn'
9
+
@@ -0,0 +1,28 @@
1
+ .container.pageHeading
2
+ %h2.pull-left Change your password
3
+ .container
4
+ .row
5
+ .span16
6
+ = form_for(resource, :as => resource_name, :url => update_password_url(resource_name), :html => { :method => :put }) do |f|
7
+ = password_instructions(devise_error_messages!)
8
+ - if resource.errors.any?
9
+ %div{ :class => 'alert-message block-message error', :id => 'error_explanation'}
10
+ %h3== #{pluralize(resource.errors.count, "error")} prohibited this user from being saved:
11
+
12
+ %ul
13
+ - resource.errors.full_messages.each do |msg|
14
+ %li= msg
15
+
16
+ %div{:style => "margin:0;padding:0;display:inline"}
17
+ = f.hidden_field :reset_password_token
18
+ %fieldset
19
+ .clearfix
20
+ = f.label :password, "New password"
21
+ .input
22
+ = f.password_field :password, :value => '', :autocomplete => 'off'
23
+ .clearfix
24
+ = f.label :password_confirmation, "Confirm new password"
25
+ .input
26
+ = f.password_field :password_confirmation, :autocomplete => 'off'
27
+ .actions
28
+ = f.submit "Change my password", :class => "btn primary"
@@ -0,0 +1,20 @@
1
+ %div.container.pageContainer2
2
+ %div.row.prepend-top
3
+ %div.row.show-grid
4
+ %div.clearFloat.sectionHeading
5
+ %h3.pull-left.clearfix Forgot your password?
6
+ =form_for(resource, :as => resource_name, :url => password_url(resource_name), :html => { :method => :post }) do |f|
7
+ = password_instructions(devise_error_messages!)
8
+ %div{:class => 'instructions'} 1. Enter the email address that was used to create the account <br/> 2. An email will be sent shortly containing instructions on resetting password
9
+ %fieldset
10
+ %div{:class => 'clearfix'}
11
+ = f.label :email
12
+ %div{:class => 'input'}
13
+ = f.email_field :email, :autocomplete => 'off'
14
+ %div{:class => 'clearfix'}
15
+ %label
16
+ &nbsp;
17
+ %div{:class => 'well'}
18
+ = f.submit "Send me reset password instructions", :class => "btn primary"
19
+ = render :partial => "devise/shared/links"
20
+
@@ -0,0 +1,22 @@
1
+ %div.container.pageContainer2
2
+ %div.row.prepend-top
3
+ %div.row.show-grid
4
+ %div.span-one-half
5
+ %div.clearFloat.sectionHeading
6
+ %h3.pull-left.clearfix Forgot your password?
7
+ %div{:class => 'instructions'}
8
+ 1. Enter the email address that was used to create the account
9
+ %br 2. An email will be sent shortly containing instructions on resetting password
10
+ =form_for(resource, :as => resource_name, :url => create_password_url(resource_name), :html => { :method => :post }) do |f|
11
+ = devise_error_messages!
12
+ %fieldset
13
+ %div{:class => 'clearfix'}
14
+ = f.label :email
15
+ %div{:class => 'input'}
16
+ = f.email_field :email, :autocomplete => 'off'
17
+ %div{:class => 'clearfix'}
18
+ = f.submit "Send me reset password instructions", :class => "btn primary"
19
+ = render :partial => "devise/shared/links.erb"
20
+ %div.span-one-half
21
+ %div.clearFloat.sectionHeading
22
+ %h3.pull-left.clearfix &nbsp;
@@ -0,0 +1,25 @@
1
+ - if current_user.errors.any?
2
+ %div{ :class => 'alert-message block-message error', :id => 'error_explanation'}
3
+ %h3== #{pluralize(current_user.errors.count, "error")} prohibited this user from being saved:
4
+
5
+ %ul
6
+ - current_user.errors.full_messages.each do |msg|
7
+ %li= msg
8
+
9
+ = form_for(current_user, :url => update_first_login_url, :html => { :autocomplete => "off", :class => "form-horizontal" }) do |f|
10
+ %fieldset
11
+ %legend Change Password
12
+ %div.control-group
13
+ = f.label :current_password, "Current Password", {:class => 'control-label'}
14
+ %div.controls
15
+ = f.password_field :current_password, :autocomplete => 'off', :class => 'span3'
16
+ %div.control-group
17
+ = f.label :password, "Password", {:class => 'control-label'}
18
+ %div.controls
19
+ = f.password_field :password, :autocomplete => 'off', :class => 'span3'
20
+ %div.control-group
21
+ = f.label :password_confirmation, "Confirm Password", {:class => 'control-label'}
22
+ %div.controls
23
+ = f.password_field :password_confirmation, :autocomplete => 'off', :class => 'span3'
24
+ %div.form-actions
25
+ = f.submit "Save Changes", :class => "btn btn-primary", :tabindex => 3
@@ -0,0 +1,22 @@
1
+ = form_for(resource, :as => resource_name, :url => user_session_url, :html => { :autocomplete => "off", :class => "form-horizontal" }) do |f|
2
+ %fieldset
3
+ %legend Login
4
+ %div.control-group
5
+ = f.label :login, "Username", {:class => 'control-label'}
6
+ %div.controls
7
+ = f.text_field :login, :tabindex => 1, :value => '', :autocomplete => 'off', :size => '30', :class => 'span3'
8
+ %div.control-group
9
+ = f.label :password, "Password", {:class => 'control-label'}
10
+ %div.controls
11
+ = f.password_field :password, :tabindex => 2, :autocomplete => 'off', :class => 'span3'
12
+ %div.control-group
13
+ %div.controls
14
+ %label.checkbox
15
+ %input{ :id => "wants_first_login", :value => "1",:type => 'checkbox', :name => "wants_first_login", :tabindex => 5}
16
+ Change password after login
17
+ %div.form-actions
18
+ %label.control-label &nbsp;
19
+ = f.submit "Login", :class => "btn btn-primary", :tabindex => 3
20
+ %div.control-group
21
+ %div.controls
22
+ %a{:href => new_user_password_url(resource_name), :tabindex => 4} I have forgotten my password
@@ -0,0 +1,9 @@
1
+ %h3 Not Authorized
2
+ %div{:class => "alert alert-error" }
3
+ %h4.alert-heading
4
+ 403 error - Access denied
5
+
6
+ You are not authorized to view this page using credentials you supplied.
7
+ %br
8
+ Return to the
9
+ =link_to 'homepage', root_url
@@ -0,0 +1,19 @@
1
+ - if current_user.errors.any?
2
+ %div{ :class => 'alert-message block-message error', :id => 'error_explanation'}
3
+ %h3== #{pluralize(current_user.errors.count, "error")} prohibited this user from being saved:
4
+
5
+ %ul
6
+ - current_user.errors.full_messages.each do |msg|
7
+ %li= msg
8
+ %div{:class => 'clearfix'}
9
+ = f.label :name
10
+ %div{:class => 'input'}
11
+ = f.text_field :name, :class => 'logintext', :autocomplete => 'off'
12
+ %div{:class => 'clearfix'}
13
+ = f.label :password
14
+ %div{:class => 'input'}
15
+ = f.password_field :password, :class => 'logintext', :autocomplete => 'off'
16
+ %div{:class => 'clearfix'}
17
+ = f.label :password_confirmation
18
+ %div{:class => 'input'}
19
+ = f.password_field :password_confirmation, :class => 'logintext', :autocomplete => 'off'
@@ -0,0 +1,19 @@
1
+ - if current_user.errors.any?
2
+ %div{ :class => 'alert-message block-message error', :id => 'error_explanation'}
3
+ %h3== #{pluralize(current_user.errors.count, "error")} prohibited this user from being saved:
4
+
5
+ %ul
6
+ - current_user.errors.full_messages.each do |msg|
7
+ %li= msg
8
+
9
+ %div.container.pageContainer2
10
+ %div.row.prepend-top
11
+ %div.row.show-grid
12
+ %div.span8.offset4
13
+ = form_for([current_user], :method => 'PUT') do |f|
14
+ %div.clearFloat.sectionHeading
15
+ %h3.pull-left.clearfix Edit Your Account
16
+ = render :partial => '/users/form', :locals => { :f => f }
17
+ %div.clearFloat
18
+ = f.submit 'Save Changes', :class => 'btn primary'
19
+ = link_to 'Cancel',root_url, :class => 'btn'
@@ -0,0 +1,5 @@
1
+ %p= "Welcome #{@resource.name}!"
2
+ %p You can login to your account through the link below:
3
+ %p= link_to('Log in to my account', root_url)
4
+ %p Your login and password are the same as those specified in your Active Directory account.
5
+ %p Please do not reply to this email.
@@ -0,0 +1,6 @@
1
+ %p= "Welcome #{@resource.name}!"
2
+ %p You can login to your account through the link below:
3
+ %p= link_to('Log in to my account', root_url)
4
+ %p= "Your login name is #{@resource.login}"
5
+ %p You would receive the password in a separate mail.
6
+ %p Please do not reply to this email.
@@ -0,0 +1,7 @@
1
+ %p= "Welcome #{@resource.name}!"
2
+ %p You can login to your account through the link below:
3
+ %p= link_to('Log in to my account', root_url)
4
+ %p= "Your password is #{raw @resource.password}"
5
+ %p Use the login name you must have received in a previous mail.
6
+ %p Please change your password on your first login.
7
+ %p Please do not reply to this email.
@@ -0,0 +1,220 @@
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
+ Devise.setup do |config|
4
+ # ==> Mailer Configuration
5
+ # Configure the e-mail address which will be shown in Devise::Mailer,
6
+ # note that it will be overwritten if you use your own mailer class with default "from" parameter.
7
+ config.mailer_sender = "'Test ' <no-reply@change_me.com>"
8
+
9
+ # Configure the class responsible to send e-mails.
10
+ # config.mailer = "Devise::Mailer"
11
+
12
+ # ==> ORM configuration
13
+ # Load and configure the ORM. Supports :active_record (default) and
14
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
15
+ # available as additional gems.
16
+ require 'devise/orm/active_record'
17
+
18
+ # ==> Configuration for any authentication mechanism
19
+ # Configure which keys are used when authenticating a user. The default is
20
+ # just :email. You can configure it to use [:username, :subdomain], so for
21
+ # authenticating a user, both parameters are required. Remember that those
22
+ # parameters are used only when authenticating and not when retrieving from
23
+ # session. If you need permissions, you should implement that in a before filter.
24
+ # You can also supply a hash where the value is a boolean determining whether
25
+ # or not authentication should be aborted when the value is not present.
26
+ # config.authentication_keys = [ :email ]
27
+ config.authentication_keys = [ :login ]
28
+
29
+ # Configure parameters from the request object used for authentication. Each entry
30
+ # given should be a request method and it will automatically be passed to the
31
+ # find_for_authentication method and considered in your model lookup. For instance,
32
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
33
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
34
+ # config.request_keys = []
35
+
36
+ # Configure which authentication keys should be case-insensitive.
37
+ # These keys will be downcased upon creating or modifying a user and when used
38
+ # to authenticate or find a user. Default is :email.
39
+ config.case_insensitive_keys = [ :email, :login ]
40
+
41
+ # Configure which authentication keys should have whitespace stripped.
42
+ # These keys will have whitespace before and after removed upon creating or
43
+ # modifying a user and when used to authenticate or find a user. Default is :email.
44
+ config.strip_whitespace_keys = [ :email, :login ]
45
+
46
+ # Tell if authentication through request.params is enabled. True by default.
47
+ # config.params_authenticatable = true
48
+
49
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
50
+ # config.http_authenticatable = false
51
+
52
+ # If http headers should be returned for AJAX requests. True by default.
53
+ # config.http_authenticatable_on_xhr = true
54
+
55
+ # The realm used in Http Basic Authentication. "Application" by default.
56
+ # config.http_authentication_realm = "Application"
57
+
58
+ # It will change confirmation, password recovery and other workflows
59
+ # to behave the same regardless if the e-mail provided was right or wrong.
60
+ # Does not affect registerable.
61
+ # config.paranoid = true
62
+
63
+ # ==> Configuration for :database_authenticatable
64
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
65
+ # using other encryptors, it sets how many times you want the password re-encrypted.
66
+ #
67
+ # Limiting the stretches to just one in testing will increase the performance of
68
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
69
+ # a value less than 10 in other environments.
70
+ config.stretches = Rails.env.test? ? 1 : 10
71
+
72
+ # Setup a pepper to generate the encrypted password.
73
+ # config.pepper = <%= SecureRandom.hex(64).inspect %>
74
+ config.pepper = "7e6bee70369b7bc489e4720faf3fe16d13ae3d683172be8f8beeefc824b3acad579cfde93176a6fad70b454a8c8e7a812a66817bf8e5e7825a04d136f20e42ad"
75
+
76
+ # ==> Configuration for :confirmable
77
+ # A period that the user is allowed to access the website even without
78
+ # confirming his account. For instance, if set to 2.days, the user will be
79
+ # able to access the website for two days without confirming his account,
80
+ # access will be blocked just in the third day. Default is 0.days, meaning
81
+ # the user cannot access the website without confirming his account.
82
+ # config.confirm_within = 2.days
83
+
84
+ # Defines which key will be used when confirming an account
85
+ # config.confirmation_keys = [ :email ]
86
+
87
+ # ==> Configuration for :rememberable
88
+ # The time the user will be remembered without asking for credentials again.
89
+ # config.remember_for = 2.weeks
90
+
91
+ # If true, a valid remember token can be re-used between multiple browsers.
92
+ # config.remember_across_browsers = true
93
+
94
+ # If true, extends the user's remember period when remembered via cookie.
95
+ # config.extend_remember_period = false
96
+
97
+ # If true, uses the password salt as remember token. This should be turned
98
+ # to false if you are not using database authenticatable.
99
+ config.use_salt_as_remember_token = true
100
+
101
+ # Options to be passed to the created cookie. For instance, you can set
102
+ # :secure => true in order to force SSL only cookies.
103
+ # config.cookie_options = {}
104
+
105
+ # ==> Configuration for :validatable
106
+ # Range for password length. Default is 6..128.
107
+ config.password_length = 8..128
108
+
109
+ # Email regex used to validate email formats. It simply asserts that
110
+ # an one (and only one) @ exists in the given string. This is mainly
111
+ # to give user feedback and not to assert the e-mail validity.
112
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
113
+
114
+ # ==> Configuration for :timeoutable
115
+ # The time you want to timeout the user session without activity. After this
116
+ # time the user will be asked for credentials again. Default is 30 minutes.
117
+ # config.timeout_in = 30.minutes
118
+
119
+ # ==> Configuration for :lockable
120
+ # Defines which strategy will be used to lock an account.
121
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
122
+ # :none = No lock strategy. You should handle locking by yourself.
123
+ config.lock_strategy = :failed_attempts
124
+
125
+ # Defines which key will be used when locking and unlocking an account
126
+ # config.unlock_keys = [ :email ]
127
+
128
+ # Defines which strategy will be used to unlock an account.
129
+ # :email = Sends an unlock link to the user email
130
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
131
+ # :both = Enables both strategies
132
+ # :none = No unlock strategy. You should handle unlocking by yourself.
133
+ # config.unlock_strategy = :both
134
+
135
+ # Number of authentication tries before locking an account if lock_strategy
136
+ # is failed attempts.
137
+ # config.maximum_attempts = 20
138
+
139
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
140
+ # config.unlock_in = 1.hour
141
+
142
+ # ==> Configuration for :recoverable
143
+ #
144
+ # Defines which key will be used when recovering the password for an account
145
+ # config.reset_password_keys = [ :email ]
146
+
147
+ # Time interval you can reset your password with a reset password key.
148
+ # Don't put a too small interval or your users won't have the time to
149
+ # change their passwords.
150
+ config.reset_password_within = 2.hours
151
+
152
+ # ==> Configuration for :encryptable
153
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
154
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
155
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
156
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
157
+ # REST_AUTH_SITE_KEY to pepper)
158
+ config.encryptor = :bcrypt
159
+ # config.password_archiving_count = 5
160
+ # config.deny_old_passwords = true
161
+
162
+ # ==> Configuration for :token_authenticatable
163
+ # Defines name of the authentication token params key
164
+ # config.token_authentication_key = :auth_token
165
+
166
+ # If true, authentication through token does not store user in session and needs
167
+ # to be supplied on each request. Useful if you are using the token as API token.
168
+ # config.stateless_token = false
169
+
170
+ # ==> Scopes configuration
171
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
172
+ # "users/sessions/new". It's turned off by default because it's slower if you
173
+ # are using only default views.
174
+ # config.scoped_views = false
175
+
176
+ # Configure the default scope given to Warden. By default it's the first
177
+ # devise role declared in your routes (usually :user).
178
+ # config.default_scope = :user
179
+
180
+ # Configure sign_out behavior.
181
+ # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
182
+ # The default is true, which means any logout action will sign out all active scopes.
183
+ # config.sign_out_all_scopes = true
184
+
185
+ # ==> Navigation configuration
186
+ # Lists the formats that should be treated as navigational. Formats like
187
+ # :html, should redirect to the sign in page when the user does not have
188
+ # access, but formats like :xml or :json, should return 401.
189
+ #
190
+ # If you have any extra navigational formats, like :iphone or :mobile, you
191
+ # should add them to the navigational formats lists.
192
+ #
193
+ # The :"*/*" and "*/*" formats below is required to match Internet
194
+ # Explorer requests.
195
+ # config.navigational_formats = [:"*/*", "*/*", :html]
196
+
197
+ # The default HTTP method used to sign out a resource. Default is :delete.
198
+ config.sign_out_via = :delete
199
+
200
+ # ==> OmniAuth
201
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
202
+ # up on your models and hooks.
203
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
204
+
205
+ # ==> Warden configuration
206
+ # If you want to use other strategies, that are not supported by Devise, or
207
+ # change the failure app, you can configure them inside the config.warden block.
208
+ #
209
+ # config.warden do |manager|
210
+ # manager.intercept_401 = false
211
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
212
+ # end
213
+
214
+ config.warden do |manager|
215
+ manager.intercept_401 = false
216
+ manager.default_strategies(:scope => :user).unshift :database_authenticatable
217
+ end
218
+ config.router_name = :protected
219
+ config.parent_controller = 'ActionController::Base'
220
+ end