kuhsaft 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +13 -0
- data/app/controllers/kuhsaft/cms/admin_controller.rb +0 -1
- data/app/views/kuhsaft/cms/admin/_main_navigation.html.haml +1 -1
- data/config/routes.rb +0 -2
- data/db/migrate/20130206141601_remove_cms_admin.rb +9 -0
- data/lib/kuhsaft.rb +2 -2
- data/lib/kuhsaft/version.rb +1 -1
- data/spec/features/cms_pages_spec.rb +0 -1
- data/spec/spec_helper.rb +0 -1
- metadata +20 -28
- data/app/models/kuhsaft/cms/admin.rb +0 -20
- data/config/initializers/devise.rb +0 -231
- data/db/migrate/05_create_kuhsaft_cms_admins.rb +0 -46
- data/spec/features/cms_auth_spec.rb +0 -9
- data/spec/models/cms/admin_spec.rb +0 -26
- data/spec/support/request_macros.rb +0 -19
data/README.md
CHANGED
@@ -60,6 +60,19 @@ Load the Kuhsaft assets into your app, so you have working grids, widgets etc:
|
|
60
60
|
# application.js.coffee
|
61
61
|
//= require 'kuhsaft/application'
|
62
62
|
|
63
|
+
## Authentication
|
64
|
+
|
65
|
+
Kuhsaft itself does not ship with any form of authentication. However, it is fairly easy to add by plugging into the Kuhsaft::Cms::AdminController. An example with devise:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
# config/initializers/kuhsaft.rb
|
69
|
+
Kuhsaft::Cms::AdminController.class_eval do
|
70
|
+
before_filter :authenticate_user!
|
71
|
+
end
|
72
|
+
```
|
73
|
+
|
74
|
+
Also, be sure to have override the navigation partial in `app/views/kuhsaft/cms/admin/_main_navigation.html.haml` so you get a working logout button.
|
75
|
+
|
63
76
|
## Modifying the backend CSS
|
64
77
|
Simply override the custom css in your app with your own style at `assets/stylesheets/kuhsaft/cms/customizations.css.sass`
|
65
78
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
= link_to 'Kuhsaft CMS', '#', :class => 'brand'
|
2
2
|
%p.navbar-text.pull-right
|
3
|
-
= link_to t('.logout'),
|
3
|
+
= link_to t('.logout'), '', :method => :delete
|
4
4
|
%ul.nav
|
5
5
|
%li
|
6
6
|
= link_to Kuhsaft::Page.model_name.human(:count => 2), kuhsaft.cms_pages_path
|
data/config/routes.rb
CHANGED
data/lib/kuhsaft.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require
|
1
|
+
require 'kuhsaft/engine'
|
2
|
+
require 'compass-rails'
|
2
3
|
|
3
4
|
module Kuhsaft
|
4
5
|
require 'kuhsaft/engine'
|
@@ -11,6 +12,5 @@ module Kuhsaft
|
|
11
12
|
require 'rdiscount'
|
12
13
|
require 'compass'
|
13
14
|
require 'ancestry'
|
14
|
-
require 'devise'
|
15
15
|
require 'bootstrap-sass'
|
16
16
|
end
|
data/lib/kuhsaft/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuhsaft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-02-
|
14
|
+
date: 2013-02-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|
@@ -174,13 +174,13 @@ dependencies:
|
|
174
174
|
- !ruby/object:Gem::Version
|
175
175
|
version: 0.11.1
|
176
176
|
- !ruby/object:Gem::Dependency
|
177
|
-
name:
|
177
|
+
name: compass-rails
|
178
178
|
requirement: !ruby/object:Gem::Requirement
|
179
179
|
none: false
|
180
180
|
requirements:
|
181
181
|
- - ! '>='
|
182
182
|
- !ruby/object:Gem::Version
|
183
|
-
version: '
|
183
|
+
version: '0'
|
184
184
|
type: :runtime
|
185
185
|
prerelease: false
|
186
186
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -188,15 +188,15 @@ dependencies:
|
|
188
188
|
requirements:
|
189
189
|
- - ! '>='
|
190
190
|
- !ruby/object:Gem::Version
|
191
|
-
version: '
|
191
|
+
version: '0'
|
192
192
|
- !ruby/object:Gem::Dependency
|
193
|
-
name:
|
193
|
+
name: simple_form
|
194
194
|
requirement: !ruby/object:Gem::Requirement
|
195
195
|
none: false
|
196
196
|
requirements:
|
197
197
|
- - ! '>='
|
198
198
|
- !ruby/object:Gem::Version
|
199
|
-
version: 0
|
199
|
+
version: '2.0'
|
200
200
|
type: :runtime
|
201
201
|
prerelease: false
|
202
202
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -204,15 +204,15 @@ dependencies:
|
|
204
204
|
requirements:
|
205
205
|
- - ! '>='
|
206
206
|
- !ruby/object:Gem::Version
|
207
|
-
version: 0
|
207
|
+
version: '2.0'
|
208
208
|
- !ruby/object:Gem::Dependency
|
209
|
-
name:
|
209
|
+
name: carrierwave
|
210
210
|
requirement: !ruby/object:Gem::Requirement
|
211
211
|
none: false
|
212
212
|
requirements:
|
213
213
|
- - ! '>='
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version:
|
215
|
+
version: 0.7.1
|
216
216
|
type: :runtime
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -220,15 +220,15 @@ dependencies:
|
|
220
220
|
requirements:
|
221
221
|
- - ! '>='
|
222
222
|
- !ruby/object:Gem::Version
|
223
|
-
version:
|
223
|
+
version: 0.7.1
|
224
224
|
- !ruby/object:Gem::Dependency
|
225
|
-
name:
|
225
|
+
name: mini_magick
|
226
226
|
requirement: !ruby/object:Gem::Requirement
|
227
227
|
none: false
|
228
228
|
requirements:
|
229
229
|
- - ! '>='
|
230
230
|
- !ruby/object:Gem::Version
|
231
|
-
version: '
|
231
|
+
version: '3.4'
|
232
232
|
type: :runtime
|
233
233
|
prerelease: false
|
234
234
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -236,15 +236,15 @@ dependencies:
|
|
236
236
|
requirements:
|
237
237
|
- - ! '>='
|
238
238
|
- !ruby/object:Gem::Version
|
239
|
-
version: '
|
239
|
+
version: '3.4'
|
240
240
|
- !ruby/object:Gem::Dependency
|
241
|
-
name:
|
241
|
+
name: rdiscount
|
242
242
|
requirement: !ruby/object:Gem::Requirement
|
243
243
|
none: false
|
244
244
|
requirements:
|
245
245
|
- - ! '>='
|
246
246
|
- !ruby/object:Gem::Version
|
247
|
-
version: '
|
247
|
+
version: '1.6'
|
248
248
|
type: :runtime
|
249
249
|
prerelease: false
|
250
250
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -252,7 +252,7 @@ dependencies:
|
|
252
252
|
requirements:
|
253
253
|
- - ! '>='
|
254
254
|
- !ruby/object:Gem::Version
|
255
|
-
version: '
|
255
|
+
version: '1.6'
|
256
256
|
- !ruby/object:Gem::Dependency
|
257
257
|
name: ancestry
|
258
258
|
requirement: !ruby/object:Gem::Requirement
|
@@ -313,7 +313,6 @@ files:
|
|
313
313
|
- app/models/kuhsaft/asset.rb
|
314
314
|
- app/models/kuhsaft/brick.rb
|
315
315
|
- app/models/kuhsaft/brick_type.rb
|
316
|
-
- app/models/kuhsaft/cms/admin.rb
|
317
316
|
- app/models/kuhsaft/cms.rb
|
318
317
|
- app/models/kuhsaft/column_brick.rb
|
319
318
|
- app/models/kuhsaft/image_brick.rb
|
@@ -373,7 +372,6 @@ files:
|
|
373
372
|
- app/views/kuhsaft/video_bricks/_video_brick.html.haml
|
374
373
|
- app/views/kuhsaft/video_bricks/video_brick/_edit.html.haml
|
375
374
|
- app/views/layouts/kuhsaft/cms/application.html.haml
|
376
|
-
- config/initializers/devise.rb
|
377
375
|
- config/initializers/simple_form.rb
|
378
376
|
- config/initializers/simple_form_bootstrap.rb
|
379
377
|
- config/locales/kuhsaft.de.yml
|
@@ -402,8 +400,8 @@ files:
|
|
402
400
|
- db/migrate/02_create_kuhsaft_bricks.rb
|
403
401
|
- db/migrate/03_create_kuhsaft_brick_types.rb
|
404
402
|
- db/migrate/04_create_kuhsaft_assets.rb
|
405
|
-
- db/migrate/05_create_kuhsaft_cms_admins.rb
|
406
403
|
- db/migrate/06_add_template_name_to_kuhsaft_bricks.rb
|
404
|
+
- db/migrate/20130206141601_remove_cms_admin.rb
|
407
405
|
- db/seeds.rb
|
408
406
|
- lib/generators/kuhsaft/translations/add_generator.rb
|
409
407
|
- lib/kuhsaft/brick_list.rb
|
@@ -452,7 +450,6 @@ files:
|
|
452
450
|
- spec/dummy/public/stylesheets/.gitkeep
|
453
451
|
- spec/dummy/script/rails
|
454
452
|
- spec/factories.rb
|
455
|
-
- spec/features/cms_auth_spec.rb
|
456
453
|
- spec/features/cms_pages_spec.rb
|
457
454
|
- spec/helpers/kuhsaft/cms/application_helper_spec.rb
|
458
455
|
- spec/kuhsaft_spec.rb
|
@@ -463,7 +460,6 @@ files:
|
|
463
460
|
- spec/models/accordion_item_brick_spec.rb
|
464
461
|
- spec/models/asset_spec.rb
|
465
462
|
- spec/models/brick_spec.rb
|
466
|
-
- spec/models/cms/admin_spec.rb
|
467
463
|
- spec/models/column_brick_spec.rb
|
468
464
|
- spec/models/image_brick_spec.rb
|
469
465
|
- spec/models/image_size_spec.rb
|
@@ -477,7 +473,6 @@ files:
|
|
477
473
|
- spec/models/video_brick_spec.rb
|
478
474
|
- spec/spec_helper.rb
|
479
475
|
- spec/support/kuhsaft_spec_helper.rb
|
480
|
-
- spec/support/request_macros.rb
|
481
476
|
homepage: http://github.com/screenconcept/kuhsaft
|
482
477
|
licenses: []
|
483
478
|
post_install_message:
|
@@ -492,7 +487,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
492
487
|
version: '0'
|
493
488
|
segments:
|
494
489
|
- 0
|
495
|
-
hash:
|
490
|
+
hash: -2215178386660071528
|
496
491
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
497
492
|
none: false
|
498
493
|
requirements:
|
@@ -501,7 +496,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
501
496
|
version: '0'
|
502
497
|
segments:
|
503
498
|
- 0
|
504
|
-
hash:
|
499
|
+
hash: -2215178386660071528
|
505
500
|
requirements: []
|
506
501
|
rubyforge_project: kuhsaft
|
507
502
|
rubygems_version: 1.8.24
|
@@ -542,7 +537,6 @@ test_files:
|
|
542
537
|
- spec/dummy/public/stylesheets/.gitkeep
|
543
538
|
- spec/dummy/script/rails
|
544
539
|
- spec/factories.rb
|
545
|
-
- spec/features/cms_auth_spec.rb
|
546
540
|
- spec/features/cms_pages_spec.rb
|
547
541
|
- spec/helpers/kuhsaft/cms/application_helper_spec.rb
|
548
542
|
- spec/kuhsaft_spec.rb
|
@@ -553,7 +547,6 @@ test_files:
|
|
553
547
|
- spec/models/accordion_item_brick_spec.rb
|
554
548
|
- spec/models/asset_spec.rb
|
555
549
|
- spec/models/brick_spec.rb
|
556
|
-
- spec/models/cms/admin_spec.rb
|
557
550
|
- spec/models/column_brick_spec.rb
|
558
551
|
- spec/models/image_brick_spec.rb
|
559
552
|
- spec/models/image_size_spec.rb
|
@@ -567,4 +560,3 @@ test_files:
|
|
567
560
|
- spec/models/video_brick_spec.rb
|
568
561
|
- spec/spec_helper.rb
|
569
562
|
- spec/support/kuhsaft_spec_helper.rb
|
570
|
-
- spec/support/request_macros.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Kuhsaft
|
2
|
-
module Cms
|
3
|
-
class Admin < ActiveRecord::Base
|
4
|
-
devise :database_authenticatable, :rememberable
|
5
|
-
attr_accessible :email, :password, :password_confirmation, :remember_me
|
6
|
-
|
7
|
-
def admin?
|
8
|
-
true
|
9
|
-
end
|
10
|
-
|
11
|
-
def editor?
|
12
|
-
false
|
13
|
-
end
|
14
|
-
|
15
|
-
def author?
|
16
|
-
false
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,231 +0,0 @@
|
|
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 = "please-change-me-at-config-initializers-devise@example.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
|
-
|
28
|
-
# Configure parameters from the request object used for authentication. Each entry
|
29
|
-
# given should be a request method and it will automatically be passed to the
|
30
|
-
# find_for_authentication method and considered in your model lookup. For instance,
|
31
|
-
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
32
|
-
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
33
|
-
# config.request_keys = []
|
34
|
-
|
35
|
-
# Configure which authentication keys should be case-insensitive.
|
36
|
-
# These keys will be downcased upon creating or modifying a user and when used
|
37
|
-
# to authenticate or find a user. Default is :email.
|
38
|
-
config.case_insensitive_keys = [ :email ]
|
39
|
-
|
40
|
-
# Configure which authentication keys should have whitespace stripped.
|
41
|
-
# These keys will have whitespace before and after removed upon creating or
|
42
|
-
# modifying a user and when used to authenticate or find a user. Default is :email.
|
43
|
-
config.strip_whitespace_keys = [ :email ]
|
44
|
-
|
45
|
-
# Tell if authentication through request.params is enabled. True by default.
|
46
|
-
# It can be set to an array that will enable params authentication only for the
|
47
|
-
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
48
|
-
# enable it only for database (email + password) authentication.
|
49
|
-
# config.params_authenticatable = true
|
50
|
-
|
51
|
-
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
|
52
|
-
# It can be set to an array that will enable http authentication only for the
|
53
|
-
# given strategies, for example, `config.http_authenticatable = [:token]` will
|
54
|
-
# enable it only for token authentication.
|
55
|
-
# config.http_authenticatable = false
|
56
|
-
|
57
|
-
# If http headers should be returned for AJAX requests. True by default.
|
58
|
-
# config.http_authenticatable_on_xhr = true
|
59
|
-
|
60
|
-
# The realm used in Http Basic Authentication. "Application" by default.
|
61
|
-
# config.http_authentication_realm = "Application"
|
62
|
-
|
63
|
-
# It will change confirmation, password recovery and other workflows
|
64
|
-
# to behave the same regardless if the e-mail provided was right or wrong.
|
65
|
-
# Does not affect registerable.
|
66
|
-
# config.paranoid = true
|
67
|
-
|
68
|
-
# By default Devise will store the user in session. You can skip storage for
|
69
|
-
# :http_auth and :token_auth by adding those symbols to the array below.
|
70
|
-
# Notice that if you are skipping storage for all authentication paths, you
|
71
|
-
# may want to disable generating routes to Devise's sessions controller by
|
72
|
-
# passing :skip => :sessions to `devise_for` in your config/routes.rb
|
73
|
-
config.skip_session_storage = [:http_auth]
|
74
|
-
|
75
|
-
# ==> Configuration for :database_authenticatable
|
76
|
-
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
77
|
-
# using other encryptors, it sets how many times you want the password re-encrypted.
|
78
|
-
#
|
79
|
-
# Limiting the stretches to just one in testing will increase the performance of
|
80
|
-
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
81
|
-
# a value less than 10 in other environments.
|
82
|
-
config.stretches = Rails.env.test? ? 1 : 10
|
83
|
-
|
84
|
-
# Setup a pepper to generate the encrypted password.
|
85
|
-
# config.pepper = "2384ca9bc8766c6b40e6b055c0e9244680c06e48db1aaf3c281c0d4974bd177b51aa696c92743fb5e32d138d7945db111fac9c570d1550a1fdaf5f55a721673a"
|
86
|
-
|
87
|
-
# ==> Configuration for :confirmable
|
88
|
-
# A period that the user is allowed to access the website even without
|
89
|
-
# confirming his account. For instance, if set to 2.days, the user will be
|
90
|
-
# able to access the website for two days without confirming his account,
|
91
|
-
# access will be blocked just in the third day. Default is 0.days, meaning
|
92
|
-
# the user cannot access the website without confirming his account.
|
93
|
-
# config.allow_unconfirmed_access_for = 2.days
|
94
|
-
|
95
|
-
# If true, requires any email changes to be confirmed (exactly the same way as
|
96
|
-
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
97
|
-
# db field (see migrations). Until confirmed new email is stored in
|
98
|
-
# unconfirmed email column, and copied to email column on successful confirmation.
|
99
|
-
config.reconfirmable = true
|
100
|
-
|
101
|
-
# Defines which key will be used when confirming an account
|
102
|
-
# config.confirmation_keys = [ :email ]
|
103
|
-
|
104
|
-
# ==> Configuration for :rememberable
|
105
|
-
# The time the user will be remembered without asking for credentials again.
|
106
|
-
# config.remember_for = 2.weeks
|
107
|
-
|
108
|
-
# If true, extends the user's remember period when remembered via cookie.
|
109
|
-
# config.extend_remember_period = false
|
110
|
-
|
111
|
-
# Options to be passed to the created cookie. For instance, you can set
|
112
|
-
# :secure => true in order to force SSL only cookies.
|
113
|
-
# config.rememberable_options = {}
|
114
|
-
|
115
|
-
# ==> Configuration for :validatable
|
116
|
-
# Range for password length. Default is 6..128.
|
117
|
-
# config.password_length = 6..128
|
118
|
-
|
119
|
-
# Email regex used to validate email formats. It simply asserts that
|
120
|
-
# an one (and only one) @ exists in the given string. This is mainly
|
121
|
-
# to give user feedback and not to assert the e-mail validity.
|
122
|
-
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
123
|
-
|
124
|
-
# ==> Configuration for :timeoutable
|
125
|
-
# The time you want to timeout the user session without activity. After this
|
126
|
-
# time the user will be asked for credentials again. Default is 30 minutes.
|
127
|
-
# config.timeout_in = 30.minutes
|
128
|
-
|
129
|
-
# If true, expires auth token on session timeout.
|
130
|
-
# config.expire_auth_token_on_timeout = false
|
131
|
-
|
132
|
-
# ==> Configuration for :lockable
|
133
|
-
# Defines which strategy will be used to lock an account.
|
134
|
-
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
135
|
-
# :none = No lock strategy. You should handle locking by yourself.
|
136
|
-
# config.lock_strategy = :failed_attempts
|
137
|
-
|
138
|
-
# Defines which key will be used when locking and unlocking an account
|
139
|
-
# config.unlock_keys = [ :email ]
|
140
|
-
|
141
|
-
# Defines which strategy will be used to unlock an account.
|
142
|
-
# :email = Sends an unlock link to the user email
|
143
|
-
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
144
|
-
# :both = Enables both strategies
|
145
|
-
# :none = No unlock strategy. You should handle unlocking by yourself.
|
146
|
-
# config.unlock_strategy = :both
|
147
|
-
|
148
|
-
# Number of authentication tries before locking an account if lock_strategy
|
149
|
-
# is failed attempts.
|
150
|
-
# config.maximum_attempts = 20
|
151
|
-
|
152
|
-
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
153
|
-
# config.unlock_in = 1.hour
|
154
|
-
|
155
|
-
# ==> Configuration for :recoverable
|
156
|
-
#
|
157
|
-
# Defines which key will be used when recovering the password for an account
|
158
|
-
# config.reset_password_keys = [ :email ]
|
159
|
-
|
160
|
-
# Time interval you can reset your password with a reset password key.
|
161
|
-
# Don't put a too small interval or your users won't have the time to
|
162
|
-
# change their passwords.
|
163
|
-
config.reset_password_within = 6.hours
|
164
|
-
|
165
|
-
# ==> Configuration for :encryptable
|
166
|
-
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
167
|
-
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
168
|
-
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
169
|
-
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
170
|
-
# REST_AUTH_SITE_KEY to pepper)
|
171
|
-
# config.encryptor = :sha512
|
172
|
-
|
173
|
-
# ==> Configuration for :token_authenticatable
|
174
|
-
# Defines name of the authentication token params key
|
175
|
-
# config.token_authentication_key = :auth_token
|
176
|
-
|
177
|
-
# ==> Scopes configuration
|
178
|
-
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
179
|
-
# "users/sessions/new". It's turned off by default because it's slower if you
|
180
|
-
# are using only default views.
|
181
|
-
# config.scoped_views = false
|
182
|
-
|
183
|
-
# Configure the default scope given to Warden. By default it's the first
|
184
|
-
# devise role declared in your routes (usually :user).
|
185
|
-
# config.default_scope = :user
|
186
|
-
|
187
|
-
# Set this configuration to false if you want /users/sign_out to sign out
|
188
|
-
# only the current scope. By default, Devise signs out all scopes.
|
189
|
-
# config.sign_out_all_scopes = true
|
190
|
-
|
191
|
-
# ==> Navigation configuration
|
192
|
-
# Lists the formats that should be treated as navigational. Formats like
|
193
|
-
# :html, should redirect to the sign in page when the user does not have
|
194
|
-
# access, but formats like :xml or :json, should return 401.
|
195
|
-
#
|
196
|
-
# If you have any extra navigational formats, like :iphone or :mobile, you
|
197
|
-
# should add them to the navigational formats lists.
|
198
|
-
#
|
199
|
-
# The "*/*" below is required to match Internet Explorer requests.
|
200
|
-
# config.navigational_formats = ["*/*", :html]
|
201
|
-
|
202
|
-
# The default HTTP method used to sign out a resource. Default is :delete.
|
203
|
-
config.sign_out_via = :delete
|
204
|
-
|
205
|
-
# ==> OmniAuth
|
206
|
-
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
207
|
-
# up on your models and hooks.
|
208
|
-
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
|
209
|
-
|
210
|
-
# ==> Warden configuration
|
211
|
-
# If you want to use other strategies, that are not supported by Devise, or
|
212
|
-
# change the failure app, you can configure them inside the config.warden block.
|
213
|
-
#
|
214
|
-
# config.warden do |manager|
|
215
|
-
# manager.intercept_401 = false
|
216
|
-
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
|
217
|
-
# end
|
218
|
-
|
219
|
-
# ==> Mountable engine configurations
|
220
|
-
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
221
|
-
# is mountable, there are some extra configurations to be taken into account.
|
222
|
-
# The following options are available, assuming the engine is mounted as:
|
223
|
-
#
|
224
|
-
# mount MyEngine, at: "/my_engine"
|
225
|
-
#
|
226
|
-
config.router_name = :kuhsaft
|
227
|
-
#
|
228
|
-
# When using omniauth, Devise cannot automatically set Omniauth path,
|
229
|
-
# so you need to do it manually. For the users scope, it would be:
|
230
|
-
# config.omniauth_path_prefix = "/my_engine/users/auth"
|
231
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
class CreateKuhsaftCmsAdmins < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table(:kuhsaft_cms_admins) do |t|
|
4
|
-
## Database authenticatable
|
5
|
-
t.string :email, :null => false, :default => ""
|
6
|
-
t.string :encrypted_password, :null => false, :default => ""
|
7
|
-
|
8
|
-
## Recoverable
|
9
|
-
t.string :reset_password_token
|
10
|
-
t.datetime :reset_password_sent_at
|
11
|
-
|
12
|
-
## Rememberable
|
13
|
-
t.datetime :remember_created_at
|
14
|
-
|
15
|
-
## Trackable
|
16
|
-
t.integer :sign_in_count, :default => 0
|
17
|
-
t.datetime :current_sign_in_at
|
18
|
-
t.datetime :last_sign_in_at
|
19
|
-
t.string :current_sign_in_ip
|
20
|
-
t.string :last_sign_in_ip
|
21
|
-
|
22
|
-
## Confirmable
|
23
|
-
# t.string :confirmation_token
|
24
|
-
# t.datetime :confirmed_at
|
25
|
-
# t.datetime :confirmation_sent_at
|
26
|
-
# t.string :unconfirmed_email # Only if using reconfirmable
|
27
|
-
|
28
|
-
## Lockable
|
29
|
-
# t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
|
30
|
-
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
31
|
-
# t.datetime :locked_at
|
32
|
-
|
33
|
-
## Token authenticatable
|
34
|
-
# t.string :authentication_token
|
35
|
-
|
36
|
-
t.timestamps
|
37
|
-
end
|
38
|
-
|
39
|
-
add_index :kuhsaft_cms_admins, :email, :unique => true
|
40
|
-
add_index :kuhsaft_cms_admins, :reset_password_token, :unique => true
|
41
|
-
# add_index :kuhsaft_cms_admins, :confirmation_token, :unique => true
|
42
|
-
# add_index :kuhsaft_cms_admins, :unlock_token, :unique => true
|
43
|
-
# add_index :kuhsaft_cms_admins, :authentication_token, :unique => true
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Kuhsaft::Cms::Admin do
|
4
|
-
|
5
|
-
let :admin do
|
6
|
-
Kuhsaft::Cms::Admin.new
|
7
|
-
end
|
8
|
-
|
9
|
-
describe '#admin?' do
|
10
|
-
it 'is true and the default' do
|
11
|
-
admin.admin?.should be_true
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe '#editor?' do
|
16
|
-
it 'is false' do
|
17
|
-
admin.editor?.should be_false
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe '#author?' do
|
22
|
-
it 'is false' do
|
23
|
-
admin.author?.should be_false
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module RequestMacros
|
2
|
-
|
3
|
-
def sign_in_cms_admin
|
4
|
-
before do
|
5
|
-
Kuhsaft::Cms::Admin.create(:email => 'max@demo.com',
|
6
|
-
:password => '123456',
|
7
|
-
:password_confirmation => '123456')
|
8
|
-
|
9
|
-
visit kuhsaft.cms_pages_path
|
10
|
-
|
11
|
-
within "#new_cms_admin" do
|
12
|
-
fill_in "Email", :with => 'max@demo.com'
|
13
|
-
fill_in "Password", :with => '123456'
|
14
|
-
click_on "Sign in"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|