phoenixbricks 3.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/Gemfile +7 -0
  4. data/LICENSE.txt +674 -0
  5. data/README.md +85 -0
  6. data/bin/rbricks +5 -0
  7. data/lib/railsbricks.rb +115 -0
  8. data/lib/railsbricks/app_generator.rb +352 -0
  9. data/lib/railsbricks/assets/config/admin_post_routes.rbr +3 -0
  10. data/lib/railsbricks/assets/config/application.yml +9 -0
  11. data/lib/railsbricks/assets/config/contact_routes.rbr +2 -0
  12. data/lib/railsbricks/assets/config/initializers/devise_email/devise.rb +267 -0
  13. data/lib/railsbricks/assets/config/initializers/devise_username/devise.rb +267 -0
  14. data/lib/railsbricks/assets/config/post_routes.rbr +2 -0
  15. data/lib/railsbricks/assets/config/routes.rb +15 -0
  16. data/lib/railsbricks/assets/config/unicorn.rb +22 -0
  17. data/lib/railsbricks/assets/controllers/admin/base_controller.rb +10 -0
  18. data/lib/railsbricks/assets/controllers/admin/devise_email/users_controller.rb +66 -0
  19. data/lib/railsbricks/assets/controllers/admin/devise_username/users_controller.rb +69 -0
  20. data/lib/railsbricks/assets/controllers/admin/posts_controller.rb +73 -0
  21. data/lib/railsbricks/assets/controllers/brick_contact.rbr +23 -0
  22. data/lib/railsbricks/assets/controllers/devise_email/application_controller.rb +54 -0
  23. data/lib/railsbricks/assets/controllers/devise_username/application_controller.rb +56 -0
  24. data/lib/railsbricks/assets/controllers/pages_controller.rb +13 -0
  25. data/lib/railsbricks/assets/controllers/posts_controller.rbr +10 -0
  26. data/lib/railsbricks/assets/database/postgresql.yml +12 -0
  27. data/lib/railsbricks/assets/database/sqlite3.yml +8 -0
  28. data/lib/railsbricks/assets/gemfile/Gemfile +44 -0
  29. data/lib/railsbricks/assets/git/gitignore +30 -0
  30. data/lib/railsbricks/assets/javascripts/analytics.js.coffee +5 -0
  31. data/lib/railsbricks/assets/lib/markdown_writer.rb +19 -0
  32. data/lib/railsbricks/assets/mailers/contact_mailer.rb +13 -0
  33. data/lib/railsbricks/assets/migrations/20141010133702_create_posts.rb +17 -0
  34. data/lib/railsbricks/assets/migrations/devise_email/20141010133701_devise_create_users.rb +48 -0
  35. data/lib/railsbricks/assets/migrations/devise_username/20141010133701_devise_create_users.rb +54 -0
  36. data/lib/railsbricks/assets/models/devise_email/user.rb +41 -0
  37. data/lib/railsbricks/assets/models/devise_username/user.rb +57 -0
  38. data/lib/railsbricks/assets/models/post.rb +30 -0
  39. data/lib/railsbricks/assets/procfile/Procfile +1 -0
  40. data/lib/railsbricks/assets/seeds/devise_email/seeds_no_test_users.rb +11 -0
  41. data/lib/railsbricks/assets/seeds/devise_email/seeds_test_users.rb +24 -0
  42. data/lib/railsbricks/assets/seeds/devise_username/seeds_no_test_users.rb +12 -0
  43. data/lib/railsbricks/assets/seeds/devise_username/seeds_test_users.rb +26 -0
  44. data/lib/railsbricks/assets/stylesheets/application.scss +6 -0
  45. data/lib/railsbricks/assets/stylesheets/railsbricks_custom.scss +562 -0
  46. data/lib/railsbricks/assets/views/admin/base/admin_posts_link.rbr +1 -0
  47. data/lib/railsbricks/assets/views/admin/base/devise_email/index.html.erb +41 -0
  48. data/lib/railsbricks/assets/views/admin/base/devise_username/index.html.erb +41 -0
  49. data/lib/railsbricks/assets/views/admin/posts/_form.html.erb +54 -0
  50. data/lib/railsbricks/assets/views/admin/posts/dashboard.html.erb +9 -0
  51. data/lib/railsbricks/assets/views/admin/posts/drafts.html.erb +23 -0
  52. data/lib/railsbricks/assets/views/admin/posts/edit.html.erb +10 -0
  53. data/lib/railsbricks/assets/views/admin/posts/index.html.erb +23 -0
  54. data/lib/railsbricks/assets/views/admin/posts/new.html.erb +6 -0
  55. data/lib/railsbricks/assets/views/admin/users/devise_email/edit.html.erb +65 -0
  56. data/lib/railsbricks/assets/views/admin/users/devise_email/index.html.erb +54 -0
  57. data/lib/railsbricks/assets/views/admin/users/devise_username/edit.html.erb +74 -0
  58. data/lib/railsbricks/assets/views/admin/users/devise_username/index.html.erb +56 -0
  59. data/lib/railsbricks/assets/views/contact_mailer/contact_message.html.erb +5 -0
  60. data/lib/railsbricks/assets/views/devise/allow_signup_links.rbr +11 -0
  61. data/lib/railsbricks/assets/views/devise/devise_email/confirmations/new.html.erb +31 -0
  62. data/lib/railsbricks/assets/views/devise/devise_email/mailer/confirmation_instructions.html.erb +12 -0
  63. data/lib/railsbricks/assets/views/devise/devise_email/mailer/reset_password_instructions.html.erb +15 -0
  64. data/lib/railsbricks/assets/views/devise/devise_email/passwords/edit.html.erb +43 -0
  65. data/lib/railsbricks/assets/views/devise/devise_email/passwords/new.html.erb +31 -0
  66. data/lib/railsbricks/assets/views/devise/devise_email/registrations/edit.html.erb +63 -0
  67. data/lib/railsbricks/assets/views/devise/devise_email/registrations/new.html.erb +49 -0
  68. data/lib/railsbricks/assets/views/devise/devise_email/sessions/new.html.erb +49 -0
  69. data/lib/railsbricks/assets/views/devise/devise_email/shared/_links.erb +19 -0
  70. data/lib/railsbricks/assets/views/devise/devise_username/confirmations/new.html.erb +31 -0
  71. data/lib/railsbricks/assets/views/devise/devise_username/mailer/confirmation_instructions.html.erb +12 -0
  72. data/lib/railsbricks/assets/views/devise/devise_username/mailer/reset_password_instructions.html.erb +15 -0
  73. data/lib/railsbricks/assets/views/devise/devise_username/passwords/edit.html.erb +43 -0
  74. data/lib/railsbricks/assets/views/devise/devise_username/passwords/new.html.erb +31 -0
  75. data/lib/railsbricks/assets/views/devise/devise_username/registrations/edit.html.erb +63 -0
  76. data/lib/railsbricks/assets/views/devise/devise_username/registrations/new.html.erb +58 -0
  77. data/lib/railsbricks/assets/views/devise/devise_username/sessions/new.html.erb +49 -0
  78. data/lib/railsbricks/assets/views/devise/devise_username/shared/_links.erb +19 -0
  79. data/lib/railsbricks/assets/views/layouts/_navigation_links.html.erb +15 -0
  80. data/lib/railsbricks/assets/views/layouts/brick_analytics.rbr +11 -0
  81. data/lib/railsbricks/assets/views/pages/contact.html.erb +46 -0
  82. data/lib/railsbricks/assets/views/pages/inside.html.erb +4 -0
  83. data/lib/railsbricks/assets/views/pages/posts.html.erb +18 -0
  84. data/lib/railsbricks/assets/views/pages/show_post.html.erb +6 -0
  85. data/lib/railsbricks/auth_builder.rb +147 -0
  86. data/lib/railsbricks/config_helpers.rb +27 -0
  87. data/lib/railsbricks/config_values.rb +14 -0
  88. data/lib/railsbricks/errors.rb +18 -0
  89. data/lib/railsbricks/file_helpers.rb +54 -0
  90. data/lib/railsbricks/foundation/README.md +24 -0
  91. data/lib/railsbricks/foundation/Rakefile +6 -0
  92. data/lib/railsbricks/foundation/app/assets/images/.keep +0 -0
  93. data/lib/railsbricks/foundation/app/assets/images/apple-touch-icon-precomposed.png +0 -0
  94. data/lib/railsbricks/foundation/app/assets/images/apple-touch-icon.png +0 -0
  95. data/lib/railsbricks/foundation/app/assets/images/favicon.ico +0 -0
  96. data/lib/railsbricks/foundation/app/assets/javascripts/application.js +17 -0
  97. data/lib/railsbricks/foundation/app/assets/javascripts/common.js +7 -0
  98. data/lib/railsbricks/foundation/app/controllers/application_controller.rb +5 -0
  99. data/lib/railsbricks/foundation/app/controllers/concerns/.keep +0 -0
  100. data/lib/railsbricks/foundation/app/controllers/pages_controller.rb +7 -0
  101. data/lib/railsbricks/foundation/app/helpers/application_helper.rb +7 -0
  102. data/lib/railsbricks/foundation/app/helpers/email_helper.rb +5 -0
  103. data/lib/railsbricks/foundation/app/mailers/.keep +0 -0
  104. data/lib/railsbricks/foundation/app/models/.keep +0 -0
  105. data/lib/railsbricks/foundation/app/models/concerns/.keep +0 -0
  106. data/lib/railsbricks/foundation/app/views/layouts/_footer.html.erb +18 -0
  107. data/lib/railsbricks/foundation/app/views/layouts/_messages.html.erb +9 -0
  108. data/lib/railsbricks/foundation/app/views/layouts/_navigation.html.erb +18 -0
  109. data/lib/railsbricks/foundation/app/views/layouts/_navigation_links.html.erb +3 -0
  110. data/lib/railsbricks/foundation/app/views/layouts/application.html.erb +38 -0
  111. data/lib/railsbricks/foundation/app/views/pages/home.html.erb +2 -0
  112. data/lib/railsbricks/foundation/bin/bundle +3 -0
  113. data/lib/railsbricks/foundation/bin/rails +4 -0
  114. data/lib/railsbricks/foundation/bin/rake +4 -0
  115. data/lib/railsbricks/foundation/config.ru +4 -0
  116. data/lib/railsbricks/foundation/config/application.rb +34 -0
  117. data/lib/railsbricks/foundation/config/boot.rb +4 -0
  118. data/lib/railsbricks/foundation/config/environment.rb +5 -0
  119. data/lib/railsbricks/foundation/config/environments/development.rb +41 -0
  120. data/lib/railsbricks/foundation/config/environments/production.rb +95 -0
  121. data/lib/railsbricks/foundation/config/environments/test.rb +51 -0
  122. data/lib/railsbricks/foundation/config/initializers/backtrace_silencers.rb +7 -0
  123. data/lib/railsbricks/foundation/config/initializers/date_format.rb +27 -0
  124. data/lib/railsbricks/foundation/config/initializers/filter_parameter_logging.rb +4 -0
  125. data/lib/railsbricks/foundation/config/initializers/friendly_id.rb +88 -0
  126. data/lib/railsbricks/foundation/config/initializers/inflections.rb +16 -0
  127. data/lib/railsbricks/foundation/config/initializers/kaminari_config.rb +10 -0
  128. data/lib/railsbricks/foundation/config/initializers/mime_types.rb +5 -0
  129. data/lib/railsbricks/foundation/config/initializers/secret_token.rb +25 -0
  130. data/lib/railsbricks/foundation/config/initializers/session_store.rb +3 -0
  131. data/lib/railsbricks/foundation/config/initializers/wrap_parameters.rb +14 -0
  132. data/lib/railsbricks/foundation/config/locales/en.yml +23 -0
  133. data/lib/railsbricks/foundation/config/routes.rb +7 -0
  134. data/lib/railsbricks/foundation/db/migrate/20131103142222_create_friendly_id_slugs.rb +15 -0
  135. data/lib/railsbricks/foundation/db/schema.rb +29 -0
  136. data/lib/railsbricks/foundation/db/seeds.rb +0 -0
  137. data/lib/railsbricks/foundation/lib/assets/.keep +0 -0
  138. data/lib/railsbricks/foundation/lib/tasks/.keep +0 -0
  139. data/lib/railsbricks/foundation/public/404.html +58 -0
  140. data/lib/railsbricks/foundation/public/422.html +58 -0
  141. data/lib/railsbricks/foundation/public/500.html +57 -0
  142. data/lib/railsbricks/foundation/public/favicon.ico +0 -0
  143. data/lib/railsbricks/foundation/public/robots.txt +5 -0
  144. data/lib/railsbricks/foundation/vendor/assets/javascripts/.keep +0 -0
  145. data/lib/railsbricks/foundation/vendor/assets/stylesheets/.keep +0 -0
  146. data/lib/railsbricks/gemfile_builder.rb +118 -0
  147. data/lib/railsbricks/menu.rb +533 -0
  148. data/lib/railsbricks/post_builder.rb +103 -0
  149. data/lib/railsbricks/string_helpers.rb +39 -0
  150. data/lib/railsbricks/style_builder.rb +97 -0
  151. data/lib/railsbricks/ui_helpers.rb +11 -0
  152. data/lib/railsbricks/validator.rb +68 -0
  153. data/lib/railsbricks/version.rb +34 -0
  154. data/railsbricks.gemspec +16 -0
  155. metadata +198 -0
@@ -0,0 +1,3 @@
1
+ get "posts/drafts", to: "posts#drafts", as: "posts_drafts"
2
+ get "posts/dashboard", to: "posts#dashboard", as: "posts_dashboard"
3
+ resources :posts
@@ -0,0 +1,9 @@
1
+ # Generated by RailsBricks BRICK_VERSION
2
+ # ENVIRONMENT VARIABLES
3
+ DOMAIN: "BRICK_DOMAIN"
4
+ SENDER_EMAIL: "BRICK_SENDER"
5
+ MAILER_DOMAIN: "BRICK_MAILER_DOMAIN"
6
+ SMTP_SERVER: "BRICK_SMTP_SERVER"
7
+ SMTP_PORT: "BRICK_SMTP_PORT"
8
+ SMTP_USER: "BRICK_SMTP_USERNAME"
9
+ SMTP_PWD: "BRICK_SMTP_PASSWORD"
@@ -0,0 +1,2 @@
1
+ get "/contact", to: "pages#contact", as: "contact"
2
+ post "/emailconfirmation", to: "pages#email", as: "email_confirmation"
@@ -0,0 +1,267 @@
1
+ def secure_token
2
+ token_file = Rails.root.join('.secret')
3
+ if File.exist?(token_file)
4
+ # Use the existing token.
5
+ File.read(token_file).chomp
6
+ else
7
+ # Generate a new token and store it in token_file.
8
+ token = SecureRandom.hex(64)
9
+ File.write(token_file, token)
10
+ token
11
+ end
12
+ end
13
+
14
+ # Use this hook to configure devise mailer, warden hooks and so forth.
15
+ # Many of these configuration options can be set straight in your model.
16
+ Devise.setup do |config|
17
+ # The secret key used by Devise. Devise uses this key to generate
18
+ # random tokens. Changing this key will render invalid all existing
19
+ # confirmation, reset password and unlock tokens in the database.
20
+ config.secret_key = secure_token
21
+
22
+ # ==> Mailer Configuration
23
+ # Configure the e-mail address which will be shown in Devise::Mailer,
24
+ # note that it will be overwritten if you use your own mailer class
25
+ # with default "from" parameter.
26
+ config.mailer_sender = ENV["SENDER_EMAIL"]
27
+
28
+ # Configure the class responsible to send e-mails.
29
+ # config.mailer = 'Devise::Mailer'
30
+
31
+ # ==> ORM configuration
32
+ # Load and configure the ORM. Supports :active_record (default) and
33
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
34
+ # available as additional gems.
35
+ require 'devise/orm/active_record'
36
+
37
+ # ==> Configuration for any authentication mechanism
38
+ # Configure which keys are used when authenticating a user. The default is
39
+ # just :email. You can configure it to use [:username, :subdomain], so for
40
+ # authenticating a user, both parameters are required. Remember that those
41
+ # parameters are used only when authenticating and not when retrieving from
42
+ # session. If you need permissions, you should implement that in a before filter.
43
+ # You can also supply a hash where the value is a boolean determining whether
44
+ # or not authentication should be aborted when the value is not present.
45
+ config.authentication_keys = [ :email ]
46
+
47
+ # Configure parameters from the request object used for authentication. Each entry
48
+ # given should be a request method and it will automatically be passed to the
49
+ # find_for_authentication method and considered in your model lookup. For instance,
50
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
51
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
52
+ # config.request_keys = []
53
+
54
+ # Configure which authentication keys should be case-insensitive.
55
+ # These keys will be downcased upon creating or modifying a user and when used
56
+ # to authenticate or find a user. Default is :email.
57
+ config.case_insensitive_keys = [ :email ]
58
+
59
+ # Configure which authentication keys should have whitespace stripped.
60
+ # These keys will have whitespace before and after removed upon creating or
61
+ # modifying a user and when used to authenticate or find a user. Default is :email.
62
+ config.strip_whitespace_keys = [ :email ]
63
+
64
+ # Tell if authentication through request.params is enabled. True by default.
65
+ # It can be set to an array that will enable params authentication only for the
66
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
67
+ # enable it only for database (email + password) authentication.
68
+ # config.params_authenticatable = true
69
+
70
+ # Tell if authentication through HTTP Auth is enabled. False by default.
71
+ # It can be set to an array that will enable http authentication only for the
72
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
73
+ # enable it only for database authentication. The supported strategies are:
74
+ # :database = Support basic authentication with authentication key + password
75
+ # config.http_authenticatable = false
76
+
77
+ # If http headers should be returned for AJAX requests. True by default.
78
+ # config.http_authenticatable_on_xhr = true
79
+
80
+ # The realm used in Http Basic Authentication. 'Application' by default.
81
+ # config.http_authentication_realm = 'Application'
82
+
83
+ # It will change confirmation, password recovery and other workflows
84
+ # to behave the same regardless if the e-mail provided was right or wrong.
85
+ # Does not affect registerable.
86
+ # config.paranoid = true
87
+
88
+ # By default Devise will store the user in session. You can skip storage for
89
+ # particular strategies by setting this option.
90
+ # Notice that if you are skipping storage for all authentication paths, you
91
+ # may want to disable generating routes to Devise's sessions controller by
92
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
93
+ config.skip_session_storage = [:http_auth]
94
+
95
+ # By default, Devise cleans up the CSRF token on authentication to
96
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
97
+ # requests for sign in and sign up, you need to get a new CSRF token
98
+ # from the server. You can disable this option at your own risk.
99
+ # config.clean_up_csrf_token_on_authentication = true
100
+
101
+ # ==> Configuration for :database_authenticatable
102
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
103
+ # using other encryptors, it sets how many times you want the password re-encrypted.
104
+ #
105
+ # Limiting the stretches to just one in testing will increase the performance of
106
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
107
+ # a value less than 10 in other environments.
108
+ config.stretches = Rails.env.test? ? 1 : 10
109
+
110
+ # Setup a pepper to generate the encrypted password.
111
+ # config.pepper = '4e83d8cfef78f96087479e52152ed93d77780507d4399b6e58eb93c5106adb6ca68a82743ad67fc23feae9de4d1f69c18e3b87ad6143f8b1927a470e030358b9'
112
+
113
+ # ==> Configuration for :confirmable
114
+ # A period that the user is allowed to access the website even without
115
+ # confirming his account. For instance, if set to 2.days, the user will be
116
+ # able to access the website for two days without confirming his account,
117
+ # access will be blocked just in the third day. Default is 0.days, meaning
118
+ # the user cannot access the website without confirming his account.
119
+ # config.allow_unconfirmed_access_for = 2.days
120
+
121
+ # A period that the user is allowed to confirm their account before their
122
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
123
+ # their account within 3 days after the mail was sent, but on the fourth day
124
+ # their account can't be confirmed with the token any more.
125
+ # Default is nil, meaning there is no restriction on how long a user can take
126
+ # before confirming their account.
127
+ # config.confirm_within = 3.days
128
+
129
+ # If true, requires any email changes to be confirmed (exactly the same way as
130
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
131
+ # db field (see migrations). Until confirmed new email is stored in
132
+ # unconfirmed email column, and copied to email column on successful confirmation.
133
+ config.reconfirmable = true
134
+
135
+ # Defines which key will be used when confirming an account
136
+ config.confirmation_keys = [ :email ]
137
+
138
+ # ==> Configuration for :rememberable
139
+ # The time the user will be remembered without asking for credentials again.
140
+ config.remember_for = 6.weeks
141
+
142
+ # If true, extends the user's remember period when remembered via cookie.
143
+ config.extend_remember_period = true
144
+
145
+ # Options to be passed to the created cookie. For instance, you can set
146
+ # :secure => true in order to force SSL only cookies.
147
+ # config.rememberable_options = {}
148
+
149
+ # ==> Configuration for :validatable
150
+ # Range for password length. Default is 8..128.
151
+ config.password_length = 4..128
152
+
153
+ # Email regex used to validate email formats. It simply asserts that
154
+ # one (and only one) @ exists in the given string. This is mainly
155
+ # to give user feedback and not to assert the e-mail validity.
156
+ config.email_regexp = /\A[^@]+@[^@]+\z/
157
+
158
+ # ==> Configuration for :timeoutable
159
+ # The time you want to timeout the user session without activity. After this
160
+ # time the user will be asked for credentials again. Default is 30 minutes.
161
+ # config.timeout_in = 30.minutes
162
+
163
+ # If true, expires auth token on session timeout.
164
+ # config.expire_auth_token_on_timeout = false
165
+
166
+ # ==> Configuration for :lockable
167
+ # Defines which strategy will be used to lock an account.
168
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
169
+ # :none = No lock strategy. You should handle locking by yourself.
170
+ # config.lock_strategy = :failed_attempts
171
+
172
+ # Defines which key will be used when locking and unlocking an account
173
+ # config.unlock_keys = [ :email ]
174
+
175
+ # Defines which strategy will be used to unlock an account.
176
+ # :email = Sends an unlock link to the user email
177
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
178
+ # :both = Enables both strategies
179
+ # :none = No unlock strategy. You should handle unlocking by yourself.
180
+ # config.unlock_strategy = :both
181
+
182
+ # Number of authentication tries before locking an account if lock_strategy
183
+ # is failed attempts.
184
+ # config.maximum_attempts = 20
185
+
186
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
187
+ # config.unlock_in = 1.hour
188
+
189
+ # Warn on the last attempt before the account is locked.
190
+ # config.last_attempt_warning = false
191
+
192
+ # ==> Configuration for :recoverable
193
+ #
194
+ # Defines which key will be used when recovering the password for an account
195
+ config.reset_password_keys = [ :email ]
196
+
197
+ # Time interval you can reset your password with a reset password key.
198
+ # Don't put a too small interval or your users won't have the time to
199
+ # change their passwords.
200
+ config.reset_password_within = 6.hours
201
+
202
+ # ==> Configuration for :encryptable
203
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
204
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
205
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
206
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
207
+ # REST_AUTH_SITE_KEY to pepper).
208
+ #
209
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
210
+ # config.encryptor = :sha512
211
+
212
+ # ==> Scopes configuration
213
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
214
+ # "users/sessions/new". It's turned off by default because it's slower if you
215
+ # are using only default views.
216
+ # config.scoped_views = false
217
+
218
+ # Configure the default scope given to Warden. By default it's the first
219
+ # devise role declared in your routes (usually :user).
220
+ # config.default_scope = :user
221
+
222
+ # Set this configuration to false if you want /users/sign_out to sign out
223
+ # only the current scope. By default, Devise signs out all scopes.
224
+ # config.sign_out_all_scopes = true
225
+
226
+ # ==> Navigation configuration
227
+ # Lists the formats that should be treated as navigational. Formats like
228
+ # :html, should redirect to the sign in page when the user does not have
229
+ # access, but formats like :xml or :json, should return 401.
230
+ #
231
+ # If you have any extra navigational formats, like :iphone or :mobile, you
232
+ # should add them to the navigational formats lists.
233
+ #
234
+ # The "*/*" below is required to match Internet Explorer requests.
235
+ # config.navigational_formats = ['*/*', :html]
236
+
237
+ # The default HTTP method used to sign out a resource. Default is :delete.
238
+ config.sign_out_via = :delete
239
+
240
+ # ==> OmniAuth
241
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
242
+ # up on your models and hooks.
243
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
244
+
245
+ # ==> Warden configuration
246
+ # If you want to use other strategies, that are not supported by Devise, or
247
+ # change the failure app, you can configure them inside the config.warden block.
248
+ #
249
+ # config.warden do |manager|
250
+ # manager.intercept_401 = false
251
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
252
+ # end
253
+
254
+ # ==> Mountable engine configurations
255
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
256
+ # is mountable, there are some extra configurations to be taken into account.
257
+ # The following options are available, assuming the engine is mounted as:
258
+ #
259
+ # mount MyEngine, at: '/my_engine'
260
+ #
261
+ # The router that invoked `devise_for`, in the example above, would be:
262
+ # config.router_name = :my_engine
263
+ #
264
+ # When using omniauth, Devise cannot automatically set Omniauth path,
265
+ # so you need to do it manually. For the users scope, it would be:
266
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
267
+ end
@@ -0,0 +1,267 @@
1
+ def secure_token
2
+ token_file = Rails.root.join('.secret')
3
+ if File.exist?(token_file)
4
+ # Use the existing token.
5
+ File.read(token_file).chomp
6
+ else
7
+ # Generate a new token and store it in token_file.
8
+ token = SecureRandom.hex(64)
9
+ File.write(token_file, token)
10
+ token
11
+ end
12
+ end
13
+
14
+ # Use this hook to configure devise mailer, warden hooks and so forth.
15
+ # Many of these configuration options can be set straight in your model.
16
+ Devise.setup do |config|
17
+ # The secret key used by Devise. Devise uses this key to generate
18
+ # random tokens. Changing this key will render invalid all existing
19
+ # confirmation, reset password and unlock tokens in the database.
20
+ config.secret_key = secure_token
21
+
22
+ # ==> Mailer Configuration
23
+ # Configure the e-mail address which will be shown in Devise::Mailer,
24
+ # note that it will be overwritten if you use your own mailer class
25
+ # with default "from" parameter.
26
+ config.mailer_sender = ENV["SENDER_EMAIL"]
27
+
28
+ # Configure the class responsible to send e-mails.
29
+ # config.mailer = 'Devise::Mailer'
30
+
31
+ # ==> ORM configuration
32
+ # Load and configure the ORM. Supports :active_record (default) and
33
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
34
+ # available as additional gems.
35
+ require 'devise/orm/active_record'
36
+
37
+ # ==> Configuration for any authentication mechanism
38
+ # Configure which keys are used when authenticating a user. The default is
39
+ # just :email. You can configure it to use [:username, :subdomain], so for
40
+ # authenticating a user, both parameters are required. Remember that those
41
+ # parameters are used only when authenticating and not when retrieving from
42
+ # session. If you need permissions, you should implement that in a before filter.
43
+ # You can also supply a hash where the value is a boolean determining whether
44
+ # or not authentication should be aborted when the value is not present.
45
+ config.authentication_keys = [ :username ]
46
+
47
+ # Configure parameters from the request object used for authentication. Each entry
48
+ # given should be a request method and it will automatically be passed to the
49
+ # find_for_authentication method and considered in your model lookup. For instance,
50
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
51
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
52
+ # config.request_keys = []
53
+
54
+ # Configure which authentication keys should be case-insensitive.
55
+ # These keys will be downcased upon creating or modifying a user and when used
56
+ # to authenticate or find a user. Default is :email.
57
+ config.case_insensitive_keys = [ :username ]
58
+
59
+ # Configure which authentication keys should have whitespace stripped.
60
+ # These keys will have whitespace before and after removed upon creating or
61
+ # modifying a user and when used to authenticate or find a user. Default is :email.
62
+ config.strip_whitespace_keys = [ :username ]
63
+
64
+ # Tell if authentication through request.params is enabled. True by default.
65
+ # It can be set to an array that will enable params authentication only for the
66
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
67
+ # enable it only for database (email + password) authentication.
68
+ # config.params_authenticatable = true
69
+
70
+ # Tell if authentication through HTTP Auth is enabled. False by default.
71
+ # It can be set to an array that will enable http authentication only for the
72
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
73
+ # enable it only for database authentication. The supported strategies are:
74
+ # :database = Support basic authentication with authentication key + password
75
+ # config.http_authenticatable = false
76
+
77
+ # If http headers should be returned for AJAX requests. True by default.
78
+ # config.http_authenticatable_on_xhr = true
79
+
80
+ # The realm used in Http Basic Authentication. 'Application' by default.
81
+ # config.http_authentication_realm = 'Application'
82
+
83
+ # It will change confirmation, password recovery and other workflows
84
+ # to behave the same regardless if the e-mail provided was right or wrong.
85
+ # Does not affect registerable.
86
+ # config.paranoid = true
87
+
88
+ # By default Devise will store the user in session. You can skip storage for
89
+ # particular strategies by setting this option.
90
+ # Notice that if you are skipping storage for all authentication paths, you
91
+ # may want to disable generating routes to Devise's sessions controller by
92
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
93
+ config.skip_session_storage = [:http_auth]
94
+
95
+ # By default, Devise cleans up the CSRF token on authentication to
96
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
97
+ # requests for sign in and sign up, you need to get a new CSRF token
98
+ # from the server. You can disable this option at your own risk.
99
+ # config.clean_up_csrf_token_on_authentication = true
100
+
101
+ # ==> Configuration for :database_authenticatable
102
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
103
+ # using other encryptors, it sets how many times you want the password re-encrypted.
104
+ #
105
+ # Limiting the stretches to just one in testing will increase the performance of
106
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
107
+ # a value less than 10 in other environments.
108
+ config.stretches = Rails.env.test? ? 1 : 10
109
+
110
+ # Setup a pepper to generate the encrypted password.
111
+ # config.pepper = '4e83d8cfef78f96087479e52152ed93d77780507d4399b6e58eb93c5106adb6ca68a82743ad67fc23feae9de4d1f69c18e3b87ad6143f8b1927a470e030358b9'
112
+
113
+ # ==> Configuration for :confirmable
114
+ # A period that the user is allowed to access the website even without
115
+ # confirming his account. For instance, if set to 2.days, the user will be
116
+ # able to access the website for two days without confirming his account,
117
+ # access will be blocked just in the third day. Default is 0.days, meaning
118
+ # the user cannot access the website without confirming his account.
119
+ # config.allow_unconfirmed_access_for = 2.days
120
+
121
+ # A period that the user is allowed to confirm their account before their
122
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
123
+ # their account within 3 days after the mail was sent, but on the fourth day
124
+ # their account can't be confirmed with the token any more.
125
+ # Default is nil, meaning there is no restriction on how long a user can take
126
+ # before confirming their account.
127
+ # config.confirm_within = 3.days
128
+
129
+ # If true, requires any email changes to be confirmed (exactly the same way as
130
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
131
+ # db field (see migrations). Until confirmed new email is stored in
132
+ # unconfirmed email column, and copied to email column on successful confirmation.
133
+ config.reconfirmable = true
134
+
135
+ # Defines which key will be used when confirming an account
136
+ config.confirmation_keys = [ :username ]
137
+
138
+ # ==> Configuration for :rememberable
139
+ # The time the user will be remembered without asking for credentials again.
140
+ config.remember_for = 6.weeks
141
+
142
+ # If true, extends the user's remember period when remembered via cookie.
143
+ config.extend_remember_period = true
144
+
145
+ # Options to be passed to the created cookie. For instance, you can set
146
+ # :secure => true in order to force SSL only cookies.
147
+ # config.rememberable_options = {}
148
+
149
+ # ==> Configuration for :validatable
150
+ # Range for password length. Default is 8..128.
151
+ config.password_length = 4..128
152
+
153
+ # Email regex used to validate email formats. It simply asserts that
154
+ # one (and only one) @ exists in the given string. This is mainly
155
+ # to give user feedback and not to assert the e-mail validity.
156
+ config.email_regexp = /\A[^@]+@[^@]+\z/
157
+
158
+ # ==> Configuration for :timeoutable
159
+ # The time you want to timeout the user session without activity. After this
160
+ # time the user will be asked for credentials again. Default is 30 minutes.
161
+ # config.timeout_in = 30.minutes
162
+
163
+ # If true, expires auth token on session timeout.
164
+ # config.expire_auth_token_on_timeout = false
165
+
166
+ # ==> Configuration for :lockable
167
+ # Defines which strategy will be used to lock an account.
168
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
169
+ # :none = No lock strategy. You should handle locking by yourself.
170
+ # config.lock_strategy = :failed_attempts
171
+
172
+ # Defines which key will be used when locking and unlocking an account
173
+ # config.unlock_keys = [ :email ]
174
+
175
+ # Defines which strategy will be used to unlock an account.
176
+ # :email = Sends an unlock link to the user email
177
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
178
+ # :both = Enables both strategies
179
+ # :none = No unlock strategy. You should handle unlocking by yourself.
180
+ # config.unlock_strategy = :both
181
+
182
+ # Number of authentication tries before locking an account if lock_strategy
183
+ # is failed attempts.
184
+ # config.maximum_attempts = 20
185
+
186
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
187
+ # config.unlock_in = 1.hour
188
+
189
+ # Warn on the last attempt before the account is locked.
190
+ # config.last_attempt_warning = false
191
+
192
+ # ==> Configuration for :recoverable
193
+ #
194
+ # Defines which key will be used when recovering the password for an account
195
+ config.reset_password_keys = [ :email ]
196
+
197
+ # Time interval you can reset your password with a reset password key.
198
+ # Don't put a too small interval or your users won't have the time to
199
+ # change their passwords.
200
+ config.reset_password_within = 6.hours
201
+
202
+ # ==> Configuration for :encryptable
203
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
204
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
205
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
206
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
207
+ # REST_AUTH_SITE_KEY to pepper).
208
+ #
209
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
210
+ # config.encryptor = :sha512
211
+
212
+ # ==> Scopes configuration
213
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
214
+ # "users/sessions/new". It's turned off by default because it's slower if you
215
+ # are using only default views.
216
+ # config.scoped_views = false
217
+
218
+ # Configure the default scope given to Warden. By default it's the first
219
+ # devise role declared in your routes (usually :user).
220
+ # config.default_scope = :user
221
+
222
+ # Set this configuration to false if you want /users/sign_out to sign out
223
+ # only the current scope. By default, Devise signs out all scopes.
224
+ # config.sign_out_all_scopes = true
225
+
226
+ # ==> Navigation configuration
227
+ # Lists the formats that should be treated as navigational. Formats like
228
+ # :html, should redirect to the sign in page when the user does not have
229
+ # access, but formats like :xml or :json, should return 401.
230
+ #
231
+ # If you have any extra navigational formats, like :iphone or :mobile, you
232
+ # should add them to the navigational formats lists.
233
+ #
234
+ # The "*/*" below is required to match Internet Explorer requests.
235
+ # config.navigational_formats = ['*/*', :html]
236
+
237
+ # The default HTTP method used to sign out a resource. Default is :delete.
238
+ config.sign_out_via = :delete
239
+
240
+ # ==> OmniAuth
241
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
242
+ # up on your models and hooks.
243
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
244
+
245
+ # ==> Warden configuration
246
+ # If you want to use other strategies, that are not supported by Devise, or
247
+ # change the failure app, you can configure them inside the config.warden block.
248
+ #
249
+ # config.warden do |manager|
250
+ # manager.intercept_401 = false
251
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
252
+ # end
253
+
254
+ # ==> Mountable engine configurations
255
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
256
+ # is mountable, there are some extra configurations to be taken into account.
257
+ # The following options are available, assuming the engine is mounted as:
258
+ #
259
+ # mount MyEngine, at: '/my_engine'
260
+ #
261
+ # The router that invoked `devise_for`, in the example above, would be:
262
+ # config.router_name = :my_engine
263
+ #
264
+ # When using omniauth, Devise cannot automatically set Omniauth path,
265
+ # so you need to do it manually. For the users scope, it would be:
266
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
267
+ end