cas-cms 0.1.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 (126) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +43 -0
  4. data/Rakefile +37 -0
  5. data/app/assets/config/cas_manifest.js +2 -0
  6. data/app/assets/images/cas/black-star.svg +4 -0
  7. data/app/assets/images/cas/check.svg +4 -0
  8. data/app/assets/images/cas/dropzone-in.svg +4 -0
  9. data/app/assets/images/cas/loading.gif +0 -0
  10. data/app/assets/images/cas/white-star.svg +4 -0
  11. data/app/assets/javascripts/cas/application.js +51 -0
  12. data/app/assets/javascripts/cas/fileupload_manifest.js +269 -0
  13. data/app/assets/javascripts/cas/plugins/cas_image_gallery.js +353 -0
  14. data/app/assets/javascripts/cas/vendor/file_upload/canvas-to-blob.min.js +2 -0
  15. data/app/assets/javascripts/cas/vendor/file_upload/jquery.fileupload-image.js +326 -0
  16. data/app/assets/javascripts/cas/vendor/file_upload/jquery.fileupload-process.js +178 -0
  17. data/app/assets/javascripts/cas/vendor/file_upload/jquery.fileupload.js +1482 -0
  18. data/app/assets/javascripts/cas/vendor/file_upload/jquery.iframe-transport.js +224 -0
  19. data/app/assets/javascripts/cas/vendor/file_upload/jquery.ui.widget.js +572 -0
  20. data/app/assets/javascripts/cas/vendor/file_upload/load-image.all.min.js +2 -0
  21. data/app/assets/javascripts/cas/vendor/jquery.ui.touch-punch.min.js +11 -0
  22. data/app/assets/javascripts/cas/vendor/selectize.min.js +3 -0
  23. data/app/assets/stylesheets/cas/application.sass +17 -0
  24. data/app/assets/stylesheets/cas/colors.sass +6 -0
  25. data/app/assets/stylesheets/cas/form.sass +99 -0
  26. data/app/assets/stylesheets/cas/layout.sass +68 -0
  27. data/app/assets/stylesheets/cas/mixins.sass +34 -0
  28. data/app/assets/stylesheets/cas/plugins/attachments_form.sass +16 -0
  29. data/app/assets/stylesheets/cas/plugins/image_gallery.sass +128 -0
  30. data/app/assets/stylesheets/cas/tables.sass +13 -0
  31. data/app/assets/stylesheets/cas/typography.sass +27 -0
  32. data/app/assets/stylesheets/cas/vendors/selectize.default.css +394 -0
  33. data/app/assets/stylesheets/cas/vendors/simplegrid.css +298 -0
  34. data/app/controllers/cas/api/files_controller.rb +88 -0
  35. data/app/controllers/cas/application_controller.rb +17 -0
  36. data/app/controllers/cas/devise/sessions_controller.rb +9 -0
  37. data/app/controllers/cas/file_uploads_controller.rb +14 -0
  38. data/app/controllers/cas/sections/application_controller.rb +23 -0
  39. data/app/controllers/cas/sections/categories_controller.rb +47 -0
  40. data/app/controllers/cas/sections/contents_controller.rb +144 -0
  41. data/app/controllers/cas/sections_controller.rb +7 -0
  42. data/app/controllers/cas/users_controller.rb +61 -0
  43. data/app/helpers/cas/application_helper.rb +4 -0
  44. data/app/helpers/cas/form_helper.rb +11 -0
  45. data/app/jobs/cas/application_job.rb +4 -0
  46. data/app/jobs/cas/images/delete_job.rb +11 -0
  47. data/app/jobs/cas/images/promote_job.rb +11 -0
  48. data/app/jobs/cas/increment_pageviews_job.rb +11 -0
  49. data/app/models/cas/application_record.rb +5 -0
  50. data/app/models/cas/category.rb +6 -0
  51. data/app/models/cas/content.rb +59 -0
  52. data/app/models/cas/media_file.rb +77 -0
  53. data/app/models/cas/section.rb +10 -0
  54. data/app/models/cas/site.rb +5 -0
  55. data/app/models/cas/user.rb +39 -0
  56. data/app/uploaders/file_uploader.rb +26 -0
  57. data/app/views/cas/devise/sessions/new.html.erb +24 -0
  58. data/app/views/cas/sections/categories/_form.html.erb +19 -0
  59. data/app/views/cas/sections/categories/edit.html.erb +5 -0
  60. data/app/views/cas/sections/categories/index.html.erb +28 -0
  61. data/app/views/cas/sections/categories/new.html.erb +5 -0
  62. data/app/views/cas/sections/contents/_form_attachments.html.erb +42 -0
  63. data/app/views/cas/sections/contents/_form_attachments_template.html.erb +11 -0
  64. data/app/views/cas/sections/contents/_form_for_content.html.erb +85 -0
  65. data/app/views/cas/sections/contents/_form_for_survey.html.erb +36 -0
  66. data/app/views/cas/sections/contents/_form_images.html.erb +86 -0
  67. data/app/views/cas/sections/contents/edit.html.erb +6 -0
  68. data/app/views/cas/sections/contents/index.html.erb +71 -0
  69. data/app/views/cas/sections/contents/new.html.erb +5 -0
  70. data/app/views/cas/sections/index.html.erb +21 -0
  71. data/app/views/cas/shared/_error_messages.html.erb +12 -0
  72. data/app/views/cas/users/_form.html.erb +11 -0
  73. data/app/views/cas/users/edit.html.erb +2 -0
  74. data/app/views/cas/users/index.html.erb +34 -0
  75. data/app/views/cas/users/new.html.erb +2 -0
  76. data/app/views/layouts/cas/application.html.erb +71 -0
  77. data/config/initializers/acts_as_taggable.rb +1 -0
  78. data/config/initializers/devise.rb +277 -0
  79. data/config/initializers/shrine.rb +50 -0
  80. data/config/initializers/simple_form.rb +169 -0
  81. data/config/locales/devise.en.yml +64 -0
  82. data/config/locales/pt-BR.yml +242 -0
  83. data/config/locales/simple_form.en.yml +31 -0
  84. data/config/routes.rb +31 -0
  85. data/db/migrate/20170129212144_create_cas_sites.rb +15 -0
  86. data/db/migrate/20170219172958_create_cas_sections.rb +12 -0
  87. data/db/migrate/20170219175007_create_cas_contents.rb +17 -0
  88. data/db/migrate/20170612204500_create_cas_users.rb +14 -0
  89. data/db/migrate/20170613174724_create_cas_media_files.rb +20 -0
  90. data/db/migrate/20170613175912_create_cas_categories.rb +14 -0
  91. data/db/migrate/20170614171928_add_columns_to_cas_contents.rb +12 -0
  92. data/db/migrate/20170614172904_add_column_to_cas_sections.rb +6 -0
  93. data/db/migrate/20170615235532_add_devise_to_cas_users.rb +49 -0
  94. data/db/migrate/20170616011202_remove_password_from_cas_users.rb +5 -0
  95. data/db/migrate/20170618014204_v3_migration_fields.rb +30 -0
  96. data/db/migrate/20170623182702_add_column_category_id_to_cas_content.rb +6 -0
  97. data/db/migrate/20170624024648_rename_url_to_path_in_files.rb +7 -0
  98. data/db/migrate/20170625192119_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +36 -0
  99. data/db/migrate/20170625192120_add_missing_unique_indices.acts_as_taggable_on_engine.rb +26 -0
  100. data/db/migrate/20170625192121_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +20 -0
  101. data/db/migrate/20170625192122_add_missing_taggable_index.acts_as_taggable_on_engine.rb +15 -0
  102. data/db/migrate/20170625192123_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +15 -0
  103. data/db/migrate/20170625192124_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb +23 -0
  104. data/db/migrate/20170713210101_add_location_to_cas_content.rb +5 -0
  105. data/db/migrate/20170714043036_add_url_to_content.rb +5 -0
  106. data/db/migrate/20170718201535_add_embedded_to_content.rb +5 -0
  107. data/db/migrate/20170801171952_categories_with_jsonb_metadata.rb +6 -0
  108. data/db/migrate/20170801173256_add_published_at_to_cas_contents.rb +6 -0
  109. data/db/migrate/20170801175407_add_description_to_cas_categories.rb +5 -0
  110. data/db/migrate/20170830000000_add_data_search_extensions.rb +17 -0
  111. data/db/migrate/20170830000001_add_search_index_to_cas_contents.rb +20 -0
  112. data/db/migrate/20170830000002_use_uuid_with_acts_as_taggable_references.rb +17 -0
  113. data/db/migrate/20170919181809_pageviews_default_to_zero.rb +9 -0
  114. data/db/migrate/20171201191059_add_domains_to_cas_site.rb +6 -0
  115. data/lib/cas.rb +22 -0
  116. data/lib/cas/config.rb +42 -0
  117. data/lib/cas/engine.rb +33 -0
  118. data/lib/cas/form_field.rb +54 -0
  119. data/lib/cas/remote_callbacks.rb +36 -0
  120. data/lib/cas/section_config.rb +84 -0
  121. data/lib/cas/setup.rb +43 -0
  122. data/lib/cas/version.rb +3 -0
  123. data/lib/devise/custom_failure.rb +16 -0
  124. data/lib/tasks/cas_tasks.rake +4 -0
  125. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  126. metadata +560 -0
@@ -0,0 +1,71 @@
1
+ <div class="grid">
2
+ <div class="col-1-2">
3
+ <h1><%= @section.name %></h1>
4
+ </div>
5
+ <div class="col-1-2 section-options">
6
+ <% if Cas::SectionConfig.new(@section).form_has_field?(:category) %>
7
+ <%= link_to "Categorias", section_categories_path(@section), id: 'manage-categories' %>
8
+ <% end %>
9
+ </div>
10
+ </div>
11
+
12
+ <%= link_to 'Novo conteúdo',
13
+ new_section_content_path(@section.id),
14
+ id: 'new-content' %>
15
+
16
+ <br />
17
+ <br />
18
+
19
+ <table>
20
+ <thead>
21
+ <tr>
22
+ <th colspan="<%= Cas::SectionConfig.new(@section).list_fields.count %>">Título</th>
23
+ <th></th>
24
+ </tr>
25
+ </thead>
26
+
27
+ <tbody>
28
+ <% @contents.each do |content| %>
29
+ <tr id="content-<%= content.id %>">
30
+ <% column_no = 1 %>
31
+
32
+ <% Cas::SectionConfig.new(@section).list_fields.each do |field| %>
33
+ <td>
34
+ <% if field == 'created_at' %>
35
+ <% value = l(content.created_at, format: :short) %>
36
+ <% elsif field == 'date_year' %>
37
+ <% value = content.date.year %>
38
+ <% elsif field == 'date' %>
39
+ <% value = content.date.strftime("%d/%m/%Y") %>
40
+ <% elsif field == 'date_time' %>
41
+ <% if content.date.present? %>
42
+ <% value = l(content.date, format: :short) %>
43
+ <% end %>
44
+ <% else %>
45
+ <% value = content.public_send(field) %>
46
+ <% end %>
47
+
48
+ <% if column_no == 1 %>
49
+ <%= link_to value,
50
+ edit_section_content_path(@section.id, content),
51
+ id: "edit-content-#{content.id}" %>
52
+ <% else %>
53
+ <%= value %>
54
+ <% end %>
55
+
56
+ <% column_no += 1 %>
57
+ </td>
58
+ <% end %>
59
+ <td>
60
+ <%= link_to 'Excluir', section_content_path(@section.id, content),
61
+ method: :delete,
62
+ data: { confirm: 'Tem certeza?' },
63
+ id: "delete-content-#{content.id}" %>
64
+ </td>
65
+ </tr>
66
+ <% end %>
67
+ </tbody>
68
+ </table>
69
+ <br>
70
+
71
+ <%= paginate @contents %>
@@ -0,0 +1,5 @@
1
+ <h1><%= @section.name %>: criar</h1>
2
+
3
+ <%= render "form_for_#{@content_type}" %>
4
+
5
+ <%= link_to 'Voltar', section_contents_path %>
@@ -0,0 +1,21 @@
1
+ <table>
2
+ <thead>
3
+ <tr>
4
+ <th>Seção</th>
5
+ <th></th>
6
+ </tr>
7
+ </thead>
8
+
9
+ <% @sections.each do |section| %>
10
+ <% next unless Cas::SectionConfig.new(section).accessible_by_user?(current_user) %>
11
+ <tr id="section-<%= section.id %>">
12
+ <td><%= section.name %></td>
13
+ <td>
14
+ <%= link_to 'Novo', new_section_content_path(section), id: "new-content-#{section.id}" %>
15
+ &nbsp;
16
+ &nbsp;
17
+ <%= link_to 'Gerenciar', section_contents_path(section), id: "manage-section-#{section.id}" %>
18
+ </td>
19
+ </tr>
20
+ <% end %>
21
+ </table>
@@ -0,0 +1,12 @@
1
+ <% if @user.errors.any? %>
2
+ <div id="error_explanation">
3
+ <div class="alert alert-danger">
4
+ O formulário contém <%= pluralize(@user.errors.count, "error") %>.
5
+ </div>
6
+ <ul>
7
+ <% @user.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <%= simple_form_for(@user) do |f| %>
2
+ <%= f.input :name %><br />
3
+ <%= f.input :email %><br />
4
+ <% if current_user.admin? %>
5
+ <%= f.collection_select :roles, Cas::User::ROLES, :to_s, :humanize %></p>
6
+ <% end %>
7
+ <%= f.input :password, required: false %><br />
8
+ <%= f.input :password_confirmation %><br />
9
+
10
+ <%= f.button :submit, id: "save-form" %><br />
11
+ <% end %>
@@ -0,0 +1,2 @@
1
+ <h1>Editar Usuário</h1>
2
+ <%= render "form" %>
@@ -0,0 +1,34 @@
1
+ <div class="grid">
2
+ <div class="col-1-2">
3
+ <h1>Lista Usuários</h1>
4
+ </div>
5
+ <div class="col-1-2 section-options">
6
+ </div>
7
+ </div>
8
+
9
+ <%= link_to "Novo Usuário", new_user_path if current_user.admin? %>
10
+
11
+ <br />
12
+ <br />
13
+
14
+ <table>
15
+ <thead>
16
+ <tr>
17
+ <th>Nome</th>
18
+ <th></th>
19
+ </tr>
20
+ </thead>
21
+
22
+ <tbody>
23
+ <% @users.each do |user| %>
24
+ <tr id="user-<%= user.id %>">
25
+ <td>
26
+ <%= link_to user.name,
27
+ edit_user_path(user),
28
+ id: "edit-user-#{user.id}" %>
29
+ </td>
30
+ <td><%= user.roles.join(", ") %></td>
31
+ </tr>
32
+ <% end %>
33
+ </tbody>
34
+ </table>
@@ -0,0 +1,2 @@
1
+ <h1>Novo Usuário</h1>
2
+ <%= render "form" %>
@@ -0,0 +1,71 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Cas</title>
5
+ <%= stylesheet_link_tag "cas/application", media: "all" %>
6
+ <%= javascript_include_tag "cas/application" %>
7
+
8
+ <% if content_for?(:upload) %>
9
+ <%= javascript_include_tag "cas/fileupload_manifest" %>
10
+ <% end %>
11
+
12
+ <meta name="viewport" content="width=device-width, user-scalable=no">
13
+
14
+ <script type="text/javascript">
15
+ var paths = {
16
+ deleteFile: {
17
+ path: "<%= cas.api_files_path %>",
18
+ method: "delete"
19
+ },
20
+ fileUpload: {
21
+ path: "<%= cas.file_uploads_path %>",
22
+ method: 'post'
23
+ }
24
+ };
25
+ </script>
26
+
27
+ <%= csrf_meta_tags %>
28
+ </head>
29
+ <body>
30
+
31
+ <header>
32
+ <div class="grid top">
33
+ <div class="col-1-2">
34
+ <h1>
35
+ Admin
36
+ </h1>
37
+ </div>
38
+ <div class="col-1-2 secondary">
39
+ <% if user_signed_in? %>
40
+ <span class="profile">
41
+ <%= link_to current_user.name, cas.edit_user_path(current_user), id: "edit-profile"%>
42
+ </span>
43
+ <span class="sign-out"%>
44
+ <%= link_to "Sair", cas.destroy_user_session_path, method: :delete %>
45
+ </span>
46
+ <% end %>
47
+ </div>
48
+ </div>
49
+
50
+ <nav class="grid">
51
+ <ul>
52
+ <% if user_signed_in? %>
53
+ <li><%= link_to "Conteúdo", cas.root_path %></li>
54
+ <% end %>
55
+ <% if user_signed_in? && current_user.admin? %>
56
+ <li><%= link_to "Pessoas", cas.users_path, id: "list-people" %></li>
57
+ <% end %>
58
+ </ul>
59
+ </nav>
60
+ </header>
61
+
62
+ <section class="grid">
63
+ <div class="col-1-1">
64
+ <div class="content">
65
+ <%= yield %>
66
+ </div>
67
+ </div>
68
+ </section>
69
+
70
+ </body>
71
+ </html>
@@ -0,0 +1 @@
1
+ ActsAsTaggableOn.delimiter = [',', ' ']
@@ -0,0 +1,277 @@
1
+ require 'devise'
2
+ require 'devise/custom_failure'
3
+
4
+ # Use this hook to configure devise mailer, warden hooks and so forth.
5
+ # Many of these configuration options can be set straight in your model.
6
+ Devise.setup do |config|
7
+ config.secret_key = ENV.fetch("SECRET_KEY", "123")
8
+
9
+ # ==> Mailer Configuration
10
+ # Configure the e-mail address which will be shown in Devise::Mailer,
11
+ # note that it will be overwritten if you use your own mailer class
12
+ # with default "from" parameter.
13
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
14
+
15
+ # Configure the class responsible to send e-mails.
16
+ # config.mailer = 'Devise::Mailer'
17
+
18
+ # Configure the parent class responsible to send e-mails.
19
+ # config.parent_mailer = 'ActionMailer::Base'
20
+ config.parent_controller = 'Cas::ApplicationController'
21
+
22
+ # ==> ORM configuration
23
+ # Load and configure the ORM. Supports :active_record (default) and
24
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
25
+ # available as additional gems.
26
+ require 'devise/orm/active_record'
27
+
28
+ # ==> Configuration for any authentication mechanism
29
+ # Configure which keys are used when authenticating a user. The default is
30
+ # just :email. You can configure it to use [:username, :subdomain], so for
31
+ # authenticating a user, both parameters are required. Remember that those
32
+ # parameters are used only when authenticating and not when retrieving from
33
+ # session. If you need permissions, you should implement that in a before filter.
34
+ # You can also supply a hash where the value is a boolean determining whether
35
+ # or not authentication should be aborted when the value is not present.
36
+ # config.authentication_keys = [:email]
37
+
38
+ # Configure parameters from the request object used for authentication. Each entry
39
+ # given should be a request method and it will automatically be passed to the
40
+ # find_for_authentication method and considered in your model lookup. For instance,
41
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
42
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
43
+ # config.request_keys = []
44
+
45
+ # Configure which authentication keys should be case-insensitive.
46
+ # These keys will be downcased upon creating or modifying a user and when used
47
+ # to authenticate or find a user. Default is :email.
48
+ config.case_insensitive_keys = [:email]
49
+
50
+ # Configure which authentication keys should have whitespace stripped.
51
+ # These keys will have whitespace before and after removed upon creating or
52
+ # modifying a user and when used to authenticate or find a user. Default is :email.
53
+ config.strip_whitespace_keys = [:email]
54
+
55
+ # Tell if authentication through request.params is enabled. True by default.
56
+ # It can be set to an array that will enable params authentication only for the
57
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
58
+ # enable it only for database (email + password) authentication.
59
+ # config.params_authenticatable = true
60
+
61
+ # Tell if authentication through HTTP Auth is enabled. False by default.
62
+ # It can be set to an array that will enable http authentication only for the
63
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
64
+ # enable it only for database authentication. The supported strategies are:
65
+ # :database = Support basic authentication with authentication key + password
66
+ # config.http_authenticatable = false
67
+
68
+ # If 401 status code should be returned for AJAX requests. True by default.
69
+ # config.http_authenticatable_on_xhr = true
70
+
71
+ # The realm used in Http Basic Authentication. 'Application' by default.
72
+ # config.http_authentication_realm = 'Application'
73
+
74
+ # It will change confirmation, password recovery and other workflows
75
+ # to behave the same regardless if the e-mail provided was right or wrong.
76
+ # Does not affect registerable.
77
+ # config.paranoid = true
78
+
79
+ # By default Devise will store the user in session. You can skip storage for
80
+ # particular strategies by setting this option.
81
+ # Notice that if you are skipping storage for all authentication paths, you
82
+ # may want to disable generating routes to Devise's sessions controller by
83
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
84
+ config.skip_session_storage = [:http_auth]
85
+
86
+ # By default, Devise cleans up the CSRF token on authentication to
87
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
88
+ # requests for sign in and sign up, you need to get a new CSRF token
89
+ # from the server. You can disable this option at your own risk.
90
+ # config.clean_up_csrf_token_on_authentication = true
91
+
92
+ # When false, Devise will not attempt to reload routes on eager load.
93
+ # This can reduce the time taken to boot the app but if your application
94
+ # requires the Devise mappings to be loaded during boot time the application
95
+ # won't boot properly.
96
+ # config.reload_routes = true
97
+
98
+ # ==> Configuration for :database_authenticatable
99
+ # For bcrypt, this is the cost for hashing the password and defaults to 11. If
100
+ # using other algorithms, it sets how many times you want the password to be hashed.
101
+ #
102
+ # Limiting the stretches to just one in testing will increase the performance of
103
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
104
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
105
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
106
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
107
+ config.stretches = Rails.env.test? ? 1 : 10
108
+
109
+ # Set up a pepper to generate the hashed password.
110
+ # config.pepper = ENV.fetch("password_peper", "123")
111
+
112
+ # Send a notification to the original email when the user's email is changed.
113
+ # config.send_email_changed_notification = false
114
+
115
+ # Send a notification email when the user's password is changed.
116
+ # config.send_password_change_notification = false
117
+
118
+ # ==> Configuration for :confirmable
119
+ # A period that the user is allowed to access the website even without
120
+ # confirming their account. For instance, if set to 2.days, the user will be
121
+ # able to access the website for two days without confirming their account,
122
+ # access will be blocked just in the third day. Default is 0.days, meaning
123
+ # the user cannot access the website without confirming their account.
124
+ # config.allow_unconfirmed_access_for = 2.days
125
+
126
+ # A period that the user is allowed to confirm their account before their
127
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
128
+ # their account within 3 days after the mail was sent, but on the fourth day
129
+ # their account can't be confirmed with the token any more.
130
+ # Default is nil, meaning there is no restriction on how long a user can take
131
+ # before confirming their account.
132
+ # config.confirm_within = 3.days
133
+
134
+ # If true, requires any email changes to be confirmed (exactly the same way as
135
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
136
+ # db field (see migrations). Until confirmed, new email is stored in
137
+ # unconfirmed_email column, and copied to email column on successful confirmation.
138
+ config.reconfirmable = true
139
+
140
+ # Defines which key will be used when confirming an account
141
+ # config.confirmation_keys = [:email]
142
+
143
+ # ==> Configuration for :rememberable
144
+ # The time the user will be remembered without asking for credentials again.
145
+ # config.remember_for = 2.weeks
146
+
147
+ # Invalidates all the remember me tokens when the user signs out.
148
+ config.expire_all_remember_me_on_sign_out = true
149
+
150
+ # If true, extends the user's remember period when remembered via cookie.
151
+ # config.extend_remember_period = false
152
+
153
+ # Options to be passed to the created cookie. For instance, you can set
154
+ # secure: true in order to force SSL only cookies.
155
+ # config.rememberable_options = {}
156
+
157
+ # ==> Configuration for :validatable
158
+ # Range for password length.
159
+ config.password_length = 6..128
160
+
161
+ # Email regex used to validate email formats. It simply asserts that
162
+ # one (and only one) @ exists in the given string. This is mainly
163
+ # to give user feedback and not to assert the e-mail validity.
164
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
165
+
166
+ # ==> Configuration for :timeoutable
167
+ # The time you want to timeout the user session without activity. After this
168
+ # time the user will be asked for credentials again. Default is 30 minutes.
169
+ # config.timeout_in = 30.minutes
170
+
171
+ # ==> Configuration for :lockable
172
+ # Defines which strategy will be used to lock an account.
173
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
174
+ # :none = No lock strategy. You should handle locking by yourself.
175
+ # config.lock_strategy = :failed_attempts
176
+
177
+ # Defines which key will be used when locking and unlocking an account
178
+ # config.unlock_keys = [:email]
179
+
180
+ # Defines which strategy will be used to unlock an account.
181
+ # :email = Sends an unlock link to the user email
182
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
183
+ # :both = Enables both strategies
184
+ # :none = No unlock strategy. You should handle unlocking by yourself.
185
+ # config.unlock_strategy = :both
186
+
187
+ # Number of authentication tries before locking an account if lock_strategy
188
+ # is failed attempts.
189
+ # config.maximum_attempts = 20
190
+
191
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
192
+ # config.unlock_in = 1.hour
193
+
194
+ # Warn on the last attempt before the account is locked.
195
+ # config.last_attempt_warning = true
196
+
197
+ # ==> Configuration for :recoverable
198
+ #
199
+ # Defines which key will be used when recovering the password for an account
200
+ # config.reset_password_keys = [:email]
201
+
202
+ # Time interval you can reset your password with a reset password key.
203
+ # Don't put a too small interval or your users won't have the time to
204
+ # change their passwords.
205
+ config.reset_password_within = 6.hours
206
+
207
+ # When set to false, does not sign a user in automatically after their password is
208
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
209
+ # config.sign_in_after_reset_password = true
210
+
211
+ # ==> Configuration for :encryptable
212
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
213
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
214
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
215
+ # for default behavior) and :restful_authentication_sha1 (then you should set
216
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
217
+ #
218
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
219
+ # config.encryptor = :sha512
220
+
221
+ # ==> Scopes configuration
222
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
223
+ # "users/sessions/new". It's turned off by default because it's slower if you
224
+ # are using only default views.
225
+ # config.scoped_views = false
226
+
227
+ # Configure the default scope given to Warden. By default it's the first
228
+ # devise role declared in your routes (usually :user).
229
+ # config.default_scope = :user
230
+
231
+ # Set this configuration to false if you want /users/sign_out to sign out
232
+ # only the current scope. By default, Devise signs out all scopes.
233
+ # config.sign_out_all_scopes = true
234
+
235
+ # ==> Navigation configuration
236
+ # Lists the formats that should be treated as navigational. Formats like
237
+ # :html, should redirect to the sign in page when the user does not have
238
+ # access, but formats like :xml or :json, should return 401.
239
+ #
240
+ # If you have any extra navigational formats, like :iphone or :mobile, you
241
+ # should add them to the navigational formats lists.
242
+ #
243
+ # The "*/*" below is required to match Internet Explorer requests.
244
+ # config.navigational_formats = ['*/*', :html]
245
+
246
+ # The default HTTP method used to sign out a resource. Default is :delete.
247
+ config.sign_out_via = :delete
248
+
249
+ # ==> OmniAuth
250
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
251
+ # up on your models and hooks.
252
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
253
+
254
+ # ==> Warden configuration
255
+ # If you want to use other strategies, that are not supported by Devise, or
256
+ # change the failure app, you can configure them inside the config.warden block.
257
+ #
258
+ config.warden do |manager|
259
+ manager.failure_app = Devise::CustomFailure
260
+ # manager.intercept_401 = false
261
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
262
+ end
263
+
264
+ # ==> Mountable engine configurations
265
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
266
+ # is mountable, there are some extra configurations to be taken into account.
267
+ # The following options are available, assuming the engine is mounted as:
268
+ #
269
+ # mount MyEngine, at: '/my_engine'
270
+ #
271
+ # The router that invoked `devise_for`, in the example above, would be:
272
+ config.router_name = :cas
273
+ #
274
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
275
+ # so you need to do it manually. For the users scope, it would be:
276
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
277
+ end