bbq-devise 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.travis.yml +4 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +9 -0
- data/bbq-devise.gemspec +29 -0
- data/lib/bbq/devise.rb +56 -0
- data/lib/bbq/devise/version.rb +5 -0
- data/test/bbq_devise_test.rb +36 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/home_controller.rb +8 -0
- data/test/dummy/app/models/user.rb +6 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +17 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +3 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +26 -0
- data/test/dummy/config/environments/production.rb +49 -0
- data/test/dummy/config/environments/test.rb +35 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/devise.rb +198 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +9 -0
- data/test/dummy/db/schema.rb +19 -0
- data/test/test_helper.rb +13 -0
- metadata +210 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 972d82d04c8919c98453992e5ee8be7d087bf2f0e68d583e4fe96b143b2c04a6
|
4
|
+
data.tar.gz: f45f48e01feb93b0c416a23eeeaf85a566c209e83a41a6ab352e7b44bd3dea66
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5c00cd4a465fedf7ef9f2013f577ee15539a57261d76d02f405baa87e6b25b89a8e830f6598e360cb49826a1eb83a774892817f12e4f18341af3eff8ca3beea8
|
7
|
+
data.tar.gz: d66ca3fc2a28f2f1d9d900743988ec5b1f7dfb6bd015c1052f30b227a4fde5898c329b7640aecaf3e0c9d69911f54274b08668746488f590be7df988f475f6f3
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Paweł Pacana
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Bbq::Devise
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'bbq-devise'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install bbq-devise
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( https://github.com/[my-github-username]/bbq-devise/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bbq-devise.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bbq/devise/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "bbq-devise"
|
8
|
+
spec.version = Bbq::Devise::VERSION
|
9
|
+
spec.authors = ["Paweł Pacana"]
|
10
|
+
spec.email = ["pawel.pacana@gmail.com"]
|
11
|
+
spec.summary = %q{Devise integration for bbq.}
|
12
|
+
spec.homepage = ""
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "bbq-core", ">= 0.0"
|
21
|
+
spec.add_dependency "bbq-rails", ">= 0.0"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "devise", ">= 1.4"
|
26
|
+
spec.add_development_dependency "rails", ">= 3.2"
|
27
|
+
spec.add_development_dependency "sqlite3", ">= 1.3"
|
28
|
+
spec.add_development_dependency "minitest", "~> 4.0"
|
29
|
+
end
|
data/lib/bbq/devise.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require "bbq/devise/version"
|
2
|
+
require "securerandom"
|
3
|
+
|
4
|
+
module Bbq
|
5
|
+
module Devise
|
6
|
+
attr_accessor :devise_authentication_key, :email, :password, :scope
|
7
|
+
|
8
|
+
def self.included(klass)
|
9
|
+
require 'bbq/rails/routes'
|
10
|
+
klass.send(:include, Bbq::Rails::Routes)
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize_devise
|
14
|
+
@devise_initialized ||= begin
|
15
|
+
self.devise_authentication_key = ::Devise.authentication_keys.first
|
16
|
+
self.email = options[devise_authentication_key.to_sym] || Bbq::Devise.next_email
|
17
|
+
self.password = options[:password] || Bbq::Devise.next_password
|
18
|
+
self.scope = ::Devise.mappings.first.second.singular.to_s
|
19
|
+
true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def register
|
24
|
+
initialize_devise
|
25
|
+
visit send("new_#{scope}_registration_path")
|
26
|
+
fill_in "#{scope}_#{devise_authentication_key}", :with => @email
|
27
|
+
fill_in "#{scope}_password", :with => @password
|
28
|
+
fill_in "#{scope}_password_confirmation", :with => @password
|
29
|
+
find(:xpath, "//input[@name='commit']").click
|
30
|
+
end
|
31
|
+
|
32
|
+
def login
|
33
|
+
initialize_devise
|
34
|
+
visit send("new_#{scope}_session_path")
|
35
|
+
fill_in "#{scope}_#{devise_authentication_key}", :with => @email
|
36
|
+
fill_in "#{scope}_password", :with => @password
|
37
|
+
find(:xpath, "//input[@name='commit']").click
|
38
|
+
end
|
39
|
+
|
40
|
+
def logout
|
41
|
+
visit send("destroy_#{scope}_session_path")
|
42
|
+
end
|
43
|
+
|
44
|
+
def register_and_login
|
45
|
+
register
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.next_email
|
49
|
+
"#{SecureRandom.hex(3)}@example.com"
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.next_password
|
53
|
+
SecureRandom.hex(8)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'bbq/core/test_user'
|
3
|
+
require 'bbq/devise'
|
4
|
+
|
5
|
+
class DeviseTestUser < Bbq::Core::TestUser
|
6
|
+
include Bbq::Devise
|
7
|
+
end
|
8
|
+
|
9
|
+
class BbqDeviseTest < Minitest::Unit::TestCase
|
10
|
+
|
11
|
+
def test_user_register
|
12
|
+
user = DeviseTestUser.new
|
13
|
+
user.register
|
14
|
+
|
15
|
+
assert user.see?("dummy")
|
16
|
+
User.find_by_email(user.email).destroy
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_login_user
|
20
|
+
user = DeviseTestUser.new(:password => 'dupa.8')
|
21
|
+
user.register
|
22
|
+
user.logout
|
23
|
+
user.login
|
24
|
+
|
25
|
+
assert user.see?("dummy")
|
26
|
+
User.find_by_email(user.email).destroy
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_user_without_login
|
30
|
+
user = DeviseTestUser.new
|
31
|
+
user.visit user.root_path
|
32
|
+
|
33
|
+
assert user.not_see?("dummy")
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
5
|
+
require 'rake'
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "active_model/railtie"
|
4
|
+
require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
require "action_view/railtie"
|
7
|
+
require "action_mailer/railtie"
|
8
|
+
|
9
|
+
require "devise"
|
10
|
+
|
11
|
+
module Dummy
|
12
|
+
class Application < Rails::Application
|
13
|
+
config.encoding = "utf-8"
|
14
|
+
config.filter_parameters += [:password]
|
15
|
+
config.logger = Logger.new('/dev/null')
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_view.debug_rjs = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Don't care if the mailer can't send
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
19
|
+
|
20
|
+
# Print deprecation notices to the Rails logger
|
21
|
+
config.active_support.deprecation = :log
|
22
|
+
|
23
|
+
# Only use best-standards-support built into browsers
|
24
|
+
config.action_dispatch.best_standards_support = :builtin
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
5
|
+
# Code is not reloaded between requests
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Full error reports are disabled and caching is turned on
|
9
|
+
config.consider_all_requests_local = false
|
10
|
+
config.action_controller.perform_caching = true
|
11
|
+
|
12
|
+
# Specifies the header that your server uses for sending files
|
13
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
14
|
+
|
15
|
+
# For nginx:
|
16
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
|
+
|
18
|
+
# If you have no front-end server that supports something like X-Sendfile,
|
19
|
+
# just comment this out and Rails will serve the files
|
20
|
+
|
21
|
+
# See everything in the log (default is :info)
|
22
|
+
# config.log_level = :debug
|
23
|
+
|
24
|
+
# Use a different logger for distributed setups
|
25
|
+
# config.logger = SyslogLogger.new
|
26
|
+
|
27
|
+
# Use a different cache store in production
|
28
|
+
# config.cache_store = :mem_cache_store
|
29
|
+
|
30
|
+
# Disable Rails's static asset server
|
31
|
+
# In production, Apache or nginx will already do this
|
32
|
+
config.serve_static_assets = false
|
33
|
+
|
34
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
36
|
+
|
37
|
+
# Disable delivery errors, bad email addresses will be ignored
|
38
|
+
# config.action_mailer.raise_delivery_errors = false
|
39
|
+
|
40
|
+
# Enable threaded mode
|
41
|
+
# config.threadsafe!
|
42
|
+
|
43
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
44
|
+
# the I18n.default_locale when a translation can not be found)
|
45
|
+
config.i18n.fallbacks = true
|
46
|
+
|
47
|
+
# Send deprecation notices to registered listeners
|
48
|
+
config.active_support.deprecation = :notify
|
49
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Log error messages when you accidentally call methods on nil.
|
11
|
+
config.whiny_nils = true
|
12
|
+
|
13
|
+
# Show full error reports and disable caching
|
14
|
+
config.consider_all_requests_local = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Raise exceptions instead of rendering exception templates
|
18
|
+
config.action_dispatch.show_exceptions = false
|
19
|
+
|
20
|
+
# Disable request forgery protection in test environment
|
21
|
+
config.action_controller.allow_forgery_protection = false
|
22
|
+
|
23
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
24
|
+
# The :test delivery method accumulates sent emails in the
|
25
|
+
# ActionMailer::Base.deliveries array.
|
26
|
+
config.action_mailer.delivery_method = :test
|
27
|
+
|
28
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
29
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
30
|
+
# like if you have constraints or database-specific column types
|
31
|
+
# config.active_record.schema_format = :sql
|
32
|
+
|
33
|
+
# Print deprecation notices to the stderr
|
34
|
+
config.active_support.deprecation = :stderr
|
35
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,198 @@
|
|
1
|
+
require 'devise/version'
|
2
|
+
|
3
|
+
# Use this hook to configure devise mailer, warden hooks and so forth. The first
|
4
|
+
# four configuration values can also be set straight in your models.
|
5
|
+
Devise.setup do |config|
|
6
|
+
config.secret_key = 'a4afae774b0c49455776c2fd27d0e0f632c4553436dffc00d6d5a90fc56ab437a938277fa36ef991c37033d28465598e1ab9be069a7e297dfefd1a658370fb55' if Devise::VERSION.starts_with?("3.")
|
7
|
+
|
8
|
+
# ==> Mailer Configuration
|
9
|
+
# Configure the e-mail address which will be shown in DeviseMailer.
|
10
|
+
config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
|
11
|
+
|
12
|
+
# Configure the class responsible to send e-mails.
|
13
|
+
# config.mailer = "Devise::Mailer"
|
14
|
+
|
15
|
+
# ==> ORM configuration
|
16
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
17
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
18
|
+
# available as additional gems.
|
19
|
+
require 'devise/orm/active_record'
|
20
|
+
|
21
|
+
# ==> Configuration for any authentication mechanism
|
22
|
+
# Configure which keys are used when authenticating a user. The default is
|
23
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
24
|
+
# authenticating a user, both parameters are required. Remember that those
|
25
|
+
# parameters are used only when authenticating and not when retrieving from
|
26
|
+
# session. If you need permissions, you should implement that in a before filter.
|
27
|
+
# You can also supply a hash where the value is a boolean determining whether
|
28
|
+
# or not authentication should be aborted when the value is not present.
|
29
|
+
# config.authentication_keys = [ :email ]
|
30
|
+
|
31
|
+
# Configure parameters from the request object used for authentication. Each entry
|
32
|
+
# given should be a request method and it will automatically be passed to the
|
33
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
34
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
35
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
36
|
+
# config.request_keys = []
|
37
|
+
|
38
|
+
# Configure which authentication keys should be case-insensitive.
|
39
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
40
|
+
# to authenticate or find a user. Default is :email.
|
41
|
+
config.case_insensitive_keys = [ :email ]
|
42
|
+
|
43
|
+
# Tell if authentication through request.params is enabled. True by default.
|
44
|
+
# config.params_authenticatable = true
|
45
|
+
|
46
|
+
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
|
47
|
+
# config.http_authenticatable = false
|
48
|
+
|
49
|
+
# If http headers should be returned for AJAX requests. True by default.
|
50
|
+
# config.http_authenticatable_on_xhr = true
|
51
|
+
|
52
|
+
# The realm used in Http Basic Authentication. "Application" by default.
|
53
|
+
# config.http_authentication_realm = "Application"
|
54
|
+
|
55
|
+
# ==> Configuration for :database_authenticatable
|
56
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
57
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
58
|
+
config.stretches = 10
|
59
|
+
|
60
|
+
# Setup a pepper to generate the encrypted password.
|
61
|
+
# config.pepper = "a433ef8999e265537134701d4ade9b3cd09c66837b24f091bd39ba698456a4462a6393cd2e220b5dd6c9a2376f421d8a068a4a6b46542ba40ad282be61370e21"
|
62
|
+
|
63
|
+
# ==> Configuration for :confirmable
|
64
|
+
# The time you want to give your user to confirm his account. During this time
|
65
|
+
# he will be able to access your application without confirming. Default is 0.days
|
66
|
+
# When confirm_within is zero, the user won't be able to sign in without confirming.
|
67
|
+
# You can use this to let your user access some features of your application
|
68
|
+
# without confirming the account, but blocking it after a certain period
|
69
|
+
# (ie 2 days).
|
70
|
+
# config.confirm_within = 2.days
|
71
|
+
|
72
|
+
# Defines which key will be used when confirming an account
|
73
|
+
# config.confirmation_keys = [ :email ]
|
74
|
+
|
75
|
+
# ==> Configuration for :rememberable
|
76
|
+
# The time the user will be remembered without asking for credentials again.
|
77
|
+
# config.remember_for = 2.weeks
|
78
|
+
|
79
|
+
# If true, a valid remember token can be re-used between multiple browsers.
|
80
|
+
# config.remember_across_browsers = true
|
81
|
+
|
82
|
+
# If true, extends the user's remember period when remembered via cookie.
|
83
|
+
# config.extend_remember_period = false
|
84
|
+
|
85
|
+
# If true, uses the password salt as remember token. This should be turned
|
86
|
+
# to false if you are not using database authenticatable.
|
87
|
+
# config.use_salt_as_remember_token = true
|
88
|
+
|
89
|
+
# Options to be passed to the created cookie. For instance, you can set
|
90
|
+
# :secure => true in order to force SSL only cookies.
|
91
|
+
# config.cookie_options = {}
|
92
|
+
|
93
|
+
# ==> Configuration for :validatable
|
94
|
+
# Range for password length. Default is 6..128.
|
95
|
+
# config.password_length = 6..128
|
96
|
+
|
97
|
+
# Regex to use to validate the email address
|
98
|
+
# config.email_regexp = /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
|
99
|
+
|
100
|
+
# ==> Configuration for :timeoutable
|
101
|
+
# The time you want to timeout the user session without activity. After this
|
102
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
103
|
+
# config.timeout_in = 30.minutes
|
104
|
+
|
105
|
+
# ==> Configuration for :lockable
|
106
|
+
# Defines which strategy will be used to lock an account.
|
107
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
108
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
109
|
+
# config.lock_strategy = :failed_attempts
|
110
|
+
|
111
|
+
# Defines which key will be used when locking and unlocking an account
|
112
|
+
# config.unlock_keys = [ :email ]
|
113
|
+
|
114
|
+
# Defines which strategy will be used to unlock an account.
|
115
|
+
# :email = Sends an unlock link to the user email
|
116
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
117
|
+
# :both = Enables both strategies
|
118
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
119
|
+
# config.unlock_strategy = :both
|
120
|
+
|
121
|
+
# Number of authentication tries before locking an account if lock_strategy
|
122
|
+
# is failed attempts.
|
123
|
+
# config.maximum_attempts = 20
|
124
|
+
|
125
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
126
|
+
# config.unlock_in = 1.hour
|
127
|
+
|
128
|
+
# ==> Configuration for :recoverable
|
129
|
+
#
|
130
|
+
# Defines which key will be used when recovering the password for an account
|
131
|
+
# config.reset_password_keys = [ :email ]
|
132
|
+
|
133
|
+
# Time interval you can reset your password with a reset password key.
|
134
|
+
# Don't put a too small interval or your users won't have the time to
|
135
|
+
# change their passwords.
|
136
|
+
config.reset_password_within = 2.hours
|
137
|
+
|
138
|
+
# ==> Configuration for :encryptable
|
139
|
+
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
140
|
+
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
141
|
+
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
142
|
+
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
143
|
+
# REST_AUTH_SITE_KEY to pepper)
|
144
|
+
# config.encryptor = :sha512
|
145
|
+
|
146
|
+
# ==> Configuration for :token_authenticatable
|
147
|
+
# Defines name of the authentication token params key
|
148
|
+
# config.token_authentication_key = :auth_token
|
149
|
+
|
150
|
+
# If true, authentication through token does not store user in session and needs
|
151
|
+
# to be supplied on each request. Useful if you are using the token as API token.
|
152
|
+
# config.stateless_token = false
|
153
|
+
|
154
|
+
# ==> Scopes configuration
|
155
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
156
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
157
|
+
# are using only default views.
|
158
|
+
# config.scoped_views = false
|
159
|
+
|
160
|
+
# Configure the default scope given to Warden. By default it's the first
|
161
|
+
# devise role declared in your routes (usually :user).
|
162
|
+
# config.default_scope = :user
|
163
|
+
|
164
|
+
# Configure sign_out behavior.
|
165
|
+
# Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
|
166
|
+
# The default is true, which means any logout action will sign out all active scopes.
|
167
|
+
# config.sign_out_all_scopes = true
|
168
|
+
|
169
|
+
# ==> Navigation configuration
|
170
|
+
# Lists the formats that should be treated as navigational. Formats like
|
171
|
+
# :html, should redirect to the sign in page when the user does not have
|
172
|
+
# access, but formats like :xml or :json, should return 401.
|
173
|
+
#
|
174
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
175
|
+
# should add them to the navigational formats lists.
|
176
|
+
#
|
177
|
+
# The :"*/*" and "*/*" formats below is required to match Internet
|
178
|
+
# Explorer requests.
|
179
|
+
# config.navigational_formats = [:"*/*", "*/*", :html]
|
180
|
+
|
181
|
+
# The default HTTP method used to sign out a resource. Default is :get.
|
182
|
+
# config.sign_out_via = :get
|
183
|
+
|
184
|
+
# ==> OmniAuth
|
185
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
186
|
+
# up on your models and hooks.
|
187
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
|
188
|
+
|
189
|
+
# ==> Warden configuration
|
190
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
191
|
+
# change the failure app, you can configure them inside the config.warden block.
|
192
|
+
#
|
193
|
+
# config.warden do |manager|
|
194
|
+
# manager.failure_app = AnotherApp
|
195
|
+
# manager.intercept_401 = false
|
196
|
+
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
|
197
|
+
# end
|
198
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
Dummy::Application.config.secret_token = '04a135bb493e34c7dd6b2d0cd336d28a5ea8a5e30d2cc228573aadaaba4646636729f70f9381a0dc1ecc1be8fdff208d2be3b9b7fc5788f4f0d0466778e4bd10'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# Dummy::Application.config.session_store :active_record_store
|
@@ -0,0 +1,19 @@
|
|
1
|
+
ActiveRecord::Schema.define(:version => 20110521153145) do
|
2
|
+
create_table "users", :force => true do |t|
|
3
|
+
t.string "email", :default => "", :null => false
|
4
|
+
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
5
|
+
t.string "reset_password_token"
|
6
|
+
t.datetime "reset_password_sent_at"
|
7
|
+
t.datetime "remember_created_at"
|
8
|
+
t.integer "sign_in_count", :default => 0
|
9
|
+
t.datetime "current_sign_in_at"
|
10
|
+
t.datetime "last_sign_in_at"
|
11
|
+
t.string "current_sign_in_ip"
|
12
|
+
t.string "last_sign_in_ip"
|
13
|
+
t.datetime "created_at"
|
14
|
+
t.datetime "updated_at"
|
15
|
+
end
|
16
|
+
|
17
|
+
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
|
18
|
+
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
19
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
|
3
|
+
ENV["RAILS_ENV"] = "test"
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
|
7
|
+
ActiveRecord::Base.configurations = YAML.load(File.read(File.expand_path("../dummy/config/database.yml", __FILE__)))
|
8
|
+
ActiveRecord::Base.establish_connection("test")
|
9
|
+
ActiveRecord::Migration.verbose = false
|
10
|
+
load File.expand_path("../dummy/db/schema.rb", __FILE__)
|
11
|
+
|
12
|
+
require 'bbq/core'
|
13
|
+
Bbq::Core.app = Dummy::Application
|
metadata
ADDED
@@ -0,0 +1,210 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bbq-devise
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Paweł Pacana
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bbq-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bbq-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: devise
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.4'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.4'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.2'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: sqlite3
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.3'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.3'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: minitest
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '4.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '4.0'
|
125
|
+
description:
|
126
|
+
email:
|
127
|
+
- pawel.pacana@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".travis.yml"
|
134
|
+
- Gemfile
|
135
|
+
- LICENSE.txt
|
136
|
+
- README.md
|
137
|
+
- Rakefile
|
138
|
+
- bbq-devise.gemspec
|
139
|
+
- lib/bbq/devise.rb
|
140
|
+
- lib/bbq/devise/version.rb
|
141
|
+
- test/bbq_devise_test.rb
|
142
|
+
- test/dummy/Rakefile
|
143
|
+
- test/dummy/app/controllers/application_controller.rb
|
144
|
+
- test/dummy/app/controllers/home_controller.rb
|
145
|
+
- test/dummy/app/models/user.rb
|
146
|
+
- test/dummy/config.ru
|
147
|
+
- test/dummy/config/application.rb
|
148
|
+
- test/dummy/config/boot.rb
|
149
|
+
- test/dummy/config/database.yml
|
150
|
+
- test/dummy/config/environment.rb
|
151
|
+
- test/dummy/config/environments/development.rb
|
152
|
+
- test/dummy/config/environments/production.rb
|
153
|
+
- test/dummy/config/environments/test.rb
|
154
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
155
|
+
- test/dummy/config/initializers/devise.rb
|
156
|
+
- test/dummy/config/initializers/inflections.rb
|
157
|
+
- test/dummy/config/initializers/mime_types.rb
|
158
|
+
- test/dummy/config/initializers/secret_token.rb
|
159
|
+
- test/dummy/config/initializers/session_store.rb
|
160
|
+
- test/dummy/config/locales/en.yml
|
161
|
+
- test/dummy/config/routes.rb
|
162
|
+
- test/dummy/db/schema.rb
|
163
|
+
- test/test_helper.rb
|
164
|
+
homepage: ''
|
165
|
+
licenses:
|
166
|
+
- MIT
|
167
|
+
metadata: {}
|
168
|
+
post_install_message:
|
169
|
+
rdoc_options: []
|
170
|
+
require_paths:
|
171
|
+
- lib
|
172
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '0'
|
177
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
requirements: []
|
183
|
+
rubygems_version: 3.0.3
|
184
|
+
signing_key:
|
185
|
+
specification_version: 4
|
186
|
+
summary: Devise integration for bbq.
|
187
|
+
test_files:
|
188
|
+
- test/bbq_devise_test.rb
|
189
|
+
- test/dummy/Rakefile
|
190
|
+
- test/dummy/app/controllers/application_controller.rb
|
191
|
+
- test/dummy/app/controllers/home_controller.rb
|
192
|
+
- test/dummy/app/models/user.rb
|
193
|
+
- test/dummy/config.ru
|
194
|
+
- test/dummy/config/application.rb
|
195
|
+
- test/dummy/config/boot.rb
|
196
|
+
- test/dummy/config/database.yml
|
197
|
+
- test/dummy/config/environment.rb
|
198
|
+
- test/dummy/config/environments/development.rb
|
199
|
+
- test/dummy/config/environments/production.rb
|
200
|
+
- test/dummy/config/environments/test.rb
|
201
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
202
|
+
- test/dummy/config/initializers/devise.rb
|
203
|
+
- test/dummy/config/initializers/inflections.rb
|
204
|
+
- test/dummy/config/initializers/mime_types.rb
|
205
|
+
- test/dummy/config/initializers/secret_token.rb
|
206
|
+
- test/dummy/config/initializers/session_store.rb
|
207
|
+
- test/dummy/config/locales/en.yml
|
208
|
+
- test/dummy/config/routes.rb
|
209
|
+
- test/dummy/db/schema.rb
|
210
|
+
- test/test_helper.rb
|