johnhenry 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +34 -0
- data/app/assets/images/johnhenry/home/welcome/ga-screenshot.jpg +0 -0
- data/app/assets/images/johnhenry/home/welcome/logo-bootstrap-html-css.jpg +0 -0
- data/app/assets/images/johnhenry/home/welcome/logo-heroku.jpg +0 -0
- data/app/assets/images/johnhenry/home/welcome/logo-stripe-users.jpg +0 -0
- data/app/assets/images/johnhenry/home/welcome/sign-in-screenshot.jpg +0 -0
- data/app/assets/images/johnhenry/home/welcome/sign-up-screenshot.jpg +0 -0
- data/app/assets/images/johnhenry/home/welcome/tree-bark.png +0 -0
- data/app/assets/images/johnhenry/spinner-primary.gif +0 -0
- data/app/assets/javascripts/johnhenry/application.js +16 -0
- data/app/assets/javascripts/johnhenry/form-require-validation.js +27 -0
- data/app/assets/javascripts/johnhenry/layout.js +6 -0
- data/app/assets/javascripts/johnhenry/payment-form.js +33 -0
- data/app/assets/stylesheets/johnhenry/application.css +21 -0
- data/app/assets/stylesheets/johnhenry/home.css.scss +27 -0
- data/app/assets/stylesheets/johnhenry/payment-form.css.scss +5 -0
- data/app/assets/stylesheets/johnhenry/payments.css.scss +3 -0
- data/app/controllers/johnhenry/application_controller.rb +39 -0
- data/app/controllers/johnhenry/home_controller.rb +25 -0
- data/app/controllers/johnhenry/payments_controller.rb +146 -0
- data/app/controllers/johnhenry/registrations_controller.rb +26 -0
- data/app/controllers/johnhenry/sessions_controller.rb +5 -0
- data/app/helpers/johnhenry/application_helper.rb +4 -0
- data/app/models/payment.rb +3 -0
- data/app/models/user.rb +6 -0
- data/app/views/johnhenry/devise/confirmations/new.html.haml +9 -0
- data/app/views/johnhenry/devise/mailer/confirmation_instructions.html.haml +4 -0
- data/app/views/johnhenry/devise/mailer/reset_password_instructions.html.haml +6 -0
- data/app/views/johnhenry/devise/mailer/unlock_instructions.html.haml +5 -0
- data/app/views/johnhenry/devise/passwords/edit.html.haml +14 -0
- data/app/views/johnhenry/devise/passwords/new.html.haml +9 -0
- data/app/views/johnhenry/devise/registrations/edit.html.haml +30 -0
- data/app/views/johnhenry/devise/registrations/new.html.haml +6 -0
- data/app/views/johnhenry/devise/sessions/new.html.haml +6 -0
- data/app/views/johnhenry/devise/shared/_links.haml +21 -0
- data/app/views/johnhenry/devise/unlocks/new.html.haml +9 -0
- data/app/views/johnhenry/home/welcome.html.haml +119 -0
- data/app/views/johnhenry/payments/_form.html.haml +19 -0
- data/app/views/johnhenry/payments/edit.html.haml +7 -0
- data/app/views/johnhenry/payments/index.html.haml +22 -0
- data/app/views/johnhenry/payments/index.json.jbuilder +4 -0
- data/app/views/johnhenry/payments/new.html.haml +5 -0
- data/app/views/johnhenry/payments/show.html.haml +19 -0
- data/app/views/johnhenry/payments/show.json.jbuilder +1 -0
- data/app/views/johnhenry/shared/_payment_form.html.haml +74 -0
- data/app/views/johnhenry/shared/_signin_form.html.haml +37 -0
- data/app/views/johnhenry/shared/_signup_form.html.haml +48 -0
- data/app/views/layouts/johnhenry/application.html.haml +65 -0
- data/config/initializers/devise.rb +258 -0
- data/config/routes.rb +12 -0
- data/db/development.sqlite3 +0 -0
- data/db/migrate/20140104011356_add_users_and_payments.rb +33 -0
- data/lib/Gemfile +19 -0
- data/lib/johnhenry.rb +4 -0
- data/lib/johnhenry/engine.rb +5 -0
- data/lib/johnhenry/version.rb +3 -0
- data/lib/tasks/johnhenry_tasks.rake +129 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- metadata +311 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
= form_for(User.new,
|
2
|
+
as: :user,
|
3
|
+
url: session_path(:user),
|
4
|
+
class: 'require-validation') do |f|
|
5
|
+
.form-row
|
6
|
+
.col-xs-12.form-group.required
|
7
|
+
%label.control-label Email Address
|
8
|
+
%input.form-control{ name: 'user[email]', size: '4', type: 'text', type: :email, placeholder: 'user@example.com', autofocus: !!local_assigns[:autofocus] }/
|
9
|
+
|
10
|
+
.form-row
|
11
|
+
.col-xs-12.form-group
|
12
|
+
%label.control-label Password
|
13
|
+
-# TODO password_field :password
|
14
|
+
%input.form-control{ size: '4', type: 'text', type: :password, name: 'user[password]' }/
|
15
|
+
|
16
|
+
- if defined?(devise_mappings) && devise_mapping.rememberable?
|
17
|
+
.form-row
|
18
|
+
.col-xs-12.form-group
|
19
|
+
= f.check_box :remember_me
|
20
|
+
= f.label :remember_me
|
21
|
+
|
22
|
+
.form-row
|
23
|
+
.col-xs-12.form-group
|
24
|
+
- if signed_in?
|
25
|
+
.btn.btn-primary.form-control.disabled
|
26
|
+
Already Signed In »
|
27
|
+
- else
|
28
|
+
%button.btn.btn-primary.form-control.submit-button{ type: 'submit' }
|
29
|
+
= image_tag 'johnhenry/spinner-primary.gif', class: 'hide'
|
30
|
+
Sign In »
|
31
|
+
- if defined?(resource_name)
|
32
|
+
.col-xs-12.form-group
|
33
|
+
= render 'devise/shared/links'
|
34
|
+
.form-row
|
35
|
+
.col-xs-12.error.form-group.hide
|
36
|
+
.alert-danger.alert
|
37
|
+
Please fix the errors and try again.
|
@@ -0,0 +1,48 @@
|
|
1
|
+
= form_tag '/users', id: 'signup-form', method: 'POST', class: 'require-validation' do
|
2
|
+
.form-row
|
3
|
+
.col-xs-12.form-group.required
|
4
|
+
%label.control-label Email Address
|
5
|
+
%input.form-control{ name: 'user[email]', size: '4', type: 'text', type: :email, placeholder: 'user@example.com', autofocus: !!local_assigns[:autofocus] && !signed_in? }/
|
6
|
+
|
7
|
+
- if local_assigns[:generate_password]
|
8
|
+
%input{ type: 'hidden', name: 'user[password]' }
|
9
|
+
%input{ type: 'hidden', name: 'user[password_confirmation]' }
|
10
|
+
- else
|
11
|
+
.form-row
|
12
|
+
.col-xs-12.form-group.required
|
13
|
+
%label.control-label Password
|
14
|
+
%input.form-control{ size: '4', type: :password, name: 'user[password]' }/
|
15
|
+
.form-row
|
16
|
+
.col-xs-12.form-group.required
|
17
|
+
%label.control-label Password Confirmation
|
18
|
+
%input.form-control{ size: '4', type: :password, name: 'user[password_confirmation]' }/
|
19
|
+
- if local_assigns[:extra_inputs].present?
|
20
|
+
- local_assigns[:extra_inputs].each do |input|
|
21
|
+
.form-row
|
22
|
+
.col-xs-12.form-group{ class: input[:required] ? 'required' : '' }
|
23
|
+
- if input[:label].present?
|
24
|
+
%label.control-label= input[:label]
|
25
|
+
%input.form-control{ size: '4', type: input[:type], name: input[:name], value: input[:value] }/
|
26
|
+
|
27
|
+
.form-row
|
28
|
+
.col-xs-12.form-group
|
29
|
+
- if signed_in?
|
30
|
+
.btn.btn-primary.form-control.disabled
|
31
|
+
Already Signed Up »
|
32
|
+
- else
|
33
|
+
%button.btn.btn-primary.form-control.submit-button{ type: 'submit' }
|
34
|
+
= image_tag 'johnhenry/spinner-primary.gif', class: 'hide'
|
35
|
+
= local_assigns[:cta] || raw("Sign Up »")
|
36
|
+
- if defined?(resource_name)
|
37
|
+
.col-xs-12.form-group
|
38
|
+
= render 'devise/shared/links'
|
39
|
+
|
40
|
+
.form-row
|
41
|
+
- if defined?(resource) && resource.present?
|
42
|
+
- if (devise_errors = devise_error_messages!).present?
|
43
|
+
.col-xs-12.error.form-group
|
44
|
+
.alert-danger.alert= devise_errors
|
45
|
+
|
46
|
+
.col-xs-12.error.form-group.hide
|
47
|
+
.alert-danger.alert
|
48
|
+
Please fix the errors and try again.
|
@@ -0,0 +1,65 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
= csrf_meta_tag
|
5
|
+
= meta_tags
|
6
|
+
= stylesheet_link_tag 'application', media: 'all'
|
7
|
+
= javascript_include_tag 'application'
|
8
|
+
%body
|
9
|
+
%nav.navbar.navbar-default{role: "navigation"}
|
10
|
+
/ Brand and toggle get grouped for better mobile display
|
11
|
+
.navbar-header
|
12
|
+
%button.navbar-toggle{"data-target" => "#bs-example-navbar-collapse-1", "data-toggle" => "collapse", type: "button"}
|
13
|
+
%span.sr-only Toggle navigation
|
14
|
+
%span.icon-bar
|
15
|
+
%span.icon-bar
|
16
|
+
%span.icon-bar
|
17
|
+
%a.navbar-brand{href: '/'} John Henry Rails
|
18
|
+
/ Collect the nav links, forms, and other content for toggling
|
19
|
+
#bs-example-navbar-collapse-1.collapse.navbar-collapse
|
20
|
+
%ul.nav.navbar-nav
|
21
|
+
- if !signed_in?
|
22
|
+
%li.active
|
23
|
+
= link_to 'Sign Up', new_user_registration_path
|
24
|
+
%li
|
25
|
+
= link_to 'Sign In', new_user_session_path
|
26
|
+
%form.navbar-form.navbar-left{role: "search"}
|
27
|
+
.form-group
|
28
|
+
%input.form-control{placeholder: "Search", type: "text"}/
|
29
|
+
%button.btn.btn-default{type: "submit"} Search
|
30
|
+
- if signed_in?
|
31
|
+
%ul.nav.navbar-nav.navbar-right
|
32
|
+
%li.dropdown
|
33
|
+
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
|
34
|
+
Account
|
35
|
+
%b.caret
|
36
|
+
%ul.dropdown-menu
|
37
|
+
%li
|
38
|
+
%a{ href: payments_path } Payments
|
39
|
+
%li.divider
|
40
|
+
%li
|
41
|
+
= link_to 'Sign Out', destroy_user_session_path, method: :delete
|
42
|
+
|
43
|
+
- if notice.present? || alert.present?
|
44
|
+
.container{ style: 'width: 100%' }
|
45
|
+
.row
|
46
|
+
- if notice.present?
|
47
|
+
.col-md-12.alert.alert-success
|
48
|
+
= notice
|
49
|
+
%a.pull-right.dismiss-flash{ href: '#' } ✕
|
50
|
+
- if alert.present?
|
51
|
+
.col-md-12.alert.alert-warning
|
52
|
+
= alert
|
53
|
+
%a.pull-right.dismiss-flash{ href: '#' } ✕
|
54
|
+
= yield
|
55
|
+
|
56
|
+
- if Rails.env.production?
|
57
|
+
:javascript
|
58
|
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
59
|
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
60
|
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
61
|
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
62
|
+
|
63
|
+
ga('create', '#{ ENV['GOOGLE_ANALYTICS_UA'] }', '#{ ENV['GOOGLE_ANALYTICS_DOMAIN'] }');
|
64
|
+
ga('send', 'pageview');
|
65
|
+
|
@@ -0,0 +1,258 @@
|
|
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
|
+
# The secret key used by Devise. Devise uses this key to generate
|
5
|
+
# random tokens. Changing this key will render invalid all existing
|
6
|
+
# confirmation, reset password and unlock tokens in the database.
|
7
|
+
config.secret_key = '11fed8ebf4522c8f73484f7cd6199bae1eb3df92a11a98f5731f2dceecf27e2094cc5904edf27e557b75b9bb061e1285dcb85d3a68044013702197dbe6c568a6'
|
8
|
+
|
9
|
+
# ==> Mailer Configuration
|
10
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
11
|
+
# note that it will be overwritten if you use your own mailer class
|
12
|
+
# with default "from" parameter.
|
13
|
+
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
14
|
+
|
15
|
+
# Configure the class responsible to send e-mails.
|
16
|
+
# config.mailer = 'Devise::Mailer'
|
17
|
+
|
18
|
+
# ==> ORM configuration
|
19
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
20
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
21
|
+
# available as additional gems.
|
22
|
+
require 'devise/orm/active_record'
|
23
|
+
|
24
|
+
# ==> Configuration for any authentication mechanism
|
25
|
+
# Configure which keys are used when authenticating a user. The default is
|
26
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
27
|
+
# authenticating a user, both parameters are required. Remember that those
|
28
|
+
# parameters are used only when authenticating and not when retrieving from
|
29
|
+
# session. If you need permissions, you should implement that in a before filter.
|
30
|
+
# You can also supply a hash where the value is a boolean determining whether
|
31
|
+
# or not authentication should be aborted when the value is not present.
|
32
|
+
# config.authentication_keys = [ :email ]
|
33
|
+
|
34
|
+
# Configure parameters from the request object used for authentication. Each entry
|
35
|
+
# given should be a request method and it will automatically be passed to the
|
36
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
37
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
38
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
39
|
+
# config.request_keys = []
|
40
|
+
|
41
|
+
# Configure which authentication keys should be case-insensitive.
|
42
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
43
|
+
# to authenticate or find a user. Default is :email.
|
44
|
+
config.case_insensitive_keys = [ :email ]
|
45
|
+
|
46
|
+
# Configure which authentication keys should have whitespace stripped.
|
47
|
+
# These keys will have whitespace before and after removed upon creating or
|
48
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
49
|
+
config.strip_whitespace_keys = [ :email ]
|
50
|
+
|
51
|
+
# Tell if authentication through request.params is enabled. True by default.
|
52
|
+
# It can be set to an array that will enable params authentication only for the
|
53
|
+
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
54
|
+
# enable it only for database (email + password) authentication.
|
55
|
+
# config.params_authenticatable = true
|
56
|
+
|
57
|
+
# Tell if authentication through HTTP Auth is enabled. False by default.
|
58
|
+
# It can be set to an array that will enable http authentication only for the
|
59
|
+
# given strategies, for example, `config.http_authenticatable = [:token]` will
|
60
|
+
# enable it only for token authentication. The supported strategies are:
|
61
|
+
# :database = Support basic authentication with authentication key + password
|
62
|
+
# :token = Support basic authentication with token authentication key
|
63
|
+
# :token_options = Support token authentication with options as defined in
|
64
|
+
# http://api.rubyonrails.org/classes/ActionController/HttpAuthentication/Token.html
|
65
|
+
# config.http_authenticatable = false
|
66
|
+
|
67
|
+
# If http headers should be returned for AJAX requests. True by default.
|
68
|
+
# config.http_authenticatable_on_xhr = true
|
69
|
+
|
70
|
+
# The realm used in Http Basic Authentication. 'Application' by default.
|
71
|
+
# config.http_authentication_realm = 'Application'
|
72
|
+
|
73
|
+
# It will change confirmation, password recovery and other workflows
|
74
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
75
|
+
# Does not affect registerable.
|
76
|
+
# config.paranoid = true
|
77
|
+
|
78
|
+
# By default Devise will store the user in session. You can skip storage for
|
79
|
+
# :http_auth and :token_auth by adding those symbols to the array below.
|
80
|
+
# Notice that if you are skipping storage for all authentication paths, you
|
81
|
+
# may want to disable generating routes to Devise's sessions controller by
|
82
|
+
# passing :skip => :sessions to `devise_for` in your config/routes.rb
|
83
|
+
config.skip_session_storage = [:http_auth]
|
84
|
+
|
85
|
+
# By default, Devise cleans up the CSRF token on authentication to
|
86
|
+
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
87
|
+
# requests for sign in and sign up, you need to get a new CSRF token
|
88
|
+
# from the server. You can disable this option at your own risk.
|
89
|
+
# config.clean_up_csrf_token_on_authentication = true
|
90
|
+
|
91
|
+
# ==> Configuration for :database_authenticatable
|
92
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
93
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
94
|
+
#
|
95
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
96
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
97
|
+
# a value less than 10 in other environments.
|
98
|
+
config.stretches = Rails.env.test? ? 1 : 10
|
99
|
+
|
100
|
+
# Setup a pepper to generate the encrypted password.
|
101
|
+
# config.pepper = 'ede1bad2dc8844518da9a26db25702294708c10553ef3db12607033364af5a2f88f26ea694df109855e9a7232fcba7257fb93ea698e59ba4d2b209cf0e61827a'
|
102
|
+
|
103
|
+
# ==> Configuration for :confirmable
|
104
|
+
# A period that the user is allowed to access the website even without
|
105
|
+
# confirming his account. For instance, if set to 2.days, the user will be
|
106
|
+
# able to access the website for two days without confirming his account,
|
107
|
+
# access will be blocked just in the third day. Default is 0.days, meaning
|
108
|
+
# the user cannot access the website without confirming his account.
|
109
|
+
# config.allow_unconfirmed_access_for = 2.days
|
110
|
+
|
111
|
+
# A period that the user is allowed to confirm their account before their
|
112
|
+
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
113
|
+
# their account within 3 days after the mail was sent, but on the fourth day
|
114
|
+
# their account can't be confirmed with the token any more.
|
115
|
+
# Default is nil, meaning there is no restriction on how long a user can take
|
116
|
+
# before confirming their account.
|
117
|
+
# config.confirm_within = 3.days
|
118
|
+
|
119
|
+
# If true, requires any email changes to be confirmed (exactly the same way as
|
120
|
+
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
121
|
+
# db field (see migrations). Until confirmed new email is stored in
|
122
|
+
# unconfirmed email column, and copied to email column on successful confirmation.
|
123
|
+
config.reconfirmable = true
|
124
|
+
|
125
|
+
# Defines which key will be used when confirming an account
|
126
|
+
# config.confirmation_keys = [ :email ]
|
127
|
+
|
128
|
+
# ==> Configuration for :rememberable
|
129
|
+
# The time the user will be remembered without asking for credentials again.
|
130
|
+
# config.remember_for = 2.weeks
|
131
|
+
|
132
|
+
# If true, extends the user's remember period when remembered via cookie.
|
133
|
+
# config.extend_remember_period = false
|
134
|
+
|
135
|
+
# Options to be passed to the created cookie. For instance, you can set
|
136
|
+
# :secure => true in order to force SSL only cookies.
|
137
|
+
# config.rememberable_options = {}
|
138
|
+
|
139
|
+
# ==> Configuration for :validatable
|
140
|
+
# Range for password length. Default is 8..128.
|
141
|
+
config.password_length = 8..128
|
142
|
+
|
143
|
+
# Email regex used to validate email formats. It simply asserts that
|
144
|
+
# one (and only one) @ exists in the given string. This is mainly
|
145
|
+
# to give user feedback and not to assert the e-mail validity.
|
146
|
+
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
147
|
+
|
148
|
+
# ==> Configuration for :timeoutable
|
149
|
+
# The time you want to timeout the user session without activity. After this
|
150
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
151
|
+
# config.timeout_in = 30.minutes
|
152
|
+
|
153
|
+
# If true, expires auth token on session timeout.
|
154
|
+
# config.expire_auth_token_on_timeout = false
|
155
|
+
|
156
|
+
# ==> Configuration for :lockable
|
157
|
+
# Defines which strategy will be used to lock an account.
|
158
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
159
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
160
|
+
# config.lock_strategy = :failed_attempts
|
161
|
+
|
162
|
+
# Defines which key will be used when locking and unlocking an account
|
163
|
+
# config.unlock_keys = [ :email ]
|
164
|
+
|
165
|
+
# Defines which strategy will be used to unlock an account.
|
166
|
+
# :email = Sends an unlock link to the user email
|
167
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
168
|
+
# :both = Enables both strategies
|
169
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
170
|
+
# config.unlock_strategy = :both
|
171
|
+
|
172
|
+
# Number of authentication tries before locking an account if lock_strategy
|
173
|
+
# is failed attempts.
|
174
|
+
# config.maximum_attempts = 20
|
175
|
+
|
176
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
177
|
+
# config.unlock_in = 1.hour
|
178
|
+
|
179
|
+
# ==> Configuration for :recoverable
|
180
|
+
#
|
181
|
+
# Defines which key will be used when recovering the password for an account
|
182
|
+
# config.reset_password_keys = [ :email ]
|
183
|
+
|
184
|
+
# Time interval you can reset your password with a reset password key.
|
185
|
+
# Don't put a too small interval or your users won't have the time to
|
186
|
+
# change their passwords.
|
187
|
+
config.reset_password_within = 6.hours
|
188
|
+
|
189
|
+
# ==> Configuration for :encryptable
|
190
|
+
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
191
|
+
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
192
|
+
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
193
|
+
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
194
|
+
# REST_AUTH_SITE_KEY to pepper).
|
195
|
+
#
|
196
|
+
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
197
|
+
# config.encryptor = :sha512
|
198
|
+
|
199
|
+
# ==> Configuration for :token_authenticatable
|
200
|
+
# Defines name of the authentication token params key
|
201
|
+
# config.token_authentication_key = :auth_token
|
202
|
+
|
203
|
+
# ==> Scopes configuration
|
204
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
205
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
206
|
+
# are using only default views.
|
207
|
+
# config.scoped_views = false
|
208
|
+
|
209
|
+
# Configure the default scope given to Warden. By default it's the first
|
210
|
+
# devise role declared in your routes (usually :user).
|
211
|
+
# config.default_scope = :user
|
212
|
+
|
213
|
+
# Set this configuration to false if you want /users/sign_out to sign out
|
214
|
+
# only the current scope. By default, Devise signs out all scopes.
|
215
|
+
# config.sign_out_all_scopes = true
|
216
|
+
|
217
|
+
# ==> Navigation configuration
|
218
|
+
# Lists the formats that should be treated as navigational. Formats like
|
219
|
+
# :html, should redirect to the sign in page when the user does not have
|
220
|
+
# access, but formats like :xml or :json, should return 401.
|
221
|
+
#
|
222
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
223
|
+
# should add them to the navigational formats lists.
|
224
|
+
#
|
225
|
+
# The "*/*" below is required to match Internet Explorer requests.
|
226
|
+
# config.navigational_formats = ['*/*', :html]
|
227
|
+
|
228
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
229
|
+
config.sign_out_via = :delete
|
230
|
+
|
231
|
+
# ==> OmniAuth
|
232
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
233
|
+
# up on your models and hooks.
|
234
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
|
235
|
+
|
236
|
+
# ==> Warden configuration
|
237
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
238
|
+
# change the failure app, you can configure them inside the config.warden block.
|
239
|
+
#
|
240
|
+
# config.warden do |manager|
|
241
|
+
# manager.intercept_401 = false
|
242
|
+
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
|
243
|
+
# end
|
244
|
+
|
245
|
+
# ==> Mountable engine configurations
|
246
|
+
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
247
|
+
# is mountable, there are some extra configurations to be taken into account.
|
248
|
+
# The following options are available, assuming the engine is mounted as:
|
249
|
+
#
|
250
|
+
# mount MyEngine, at: '/my_engine'
|
251
|
+
#
|
252
|
+
# The router that invoked `devise_for`, in the example above, would be:
|
253
|
+
# config.router_name = :my_engine
|
254
|
+
#
|
255
|
+
# When using omniauth, Devise cannot automatically set Omniauth path,
|
256
|
+
# so you need to do it manually. For the users scope, it would be:
|
257
|
+
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
258
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
JohnHenry::Engine.routes.draw do
|
2
|
+
root 'home#welcome'
|
3
|
+
resources :payments
|
4
|
+
|
5
|
+
devise_for :users, controllers: {
|
6
|
+
unlocks: 'johnhenry/unlocks',
|
7
|
+
sessions: 'johnhenry/sessions',
|
8
|
+
passwords: 'johnhenry/passwords',
|
9
|
+
confirmations: 'johnhenry/confirmations',
|
10
|
+
registrations: 'johnhenry/registrations',
|
11
|
+
}
|
12
|
+
end
|
File without changes
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class AddUsersAndPayments < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table "payments", force: true do |t|
|
4
|
+
t.integer "user_id"
|
5
|
+
t.string "stripe_token"
|
6
|
+
t.string "stripe_customer_id"
|
7
|
+
t.datetime "created_at"
|
8
|
+
t.datetime "updated_at"
|
9
|
+
t.decimal "amount", default: 0.0, null: false
|
10
|
+
end
|
11
|
+
|
12
|
+
add_index "payments", ["user_id"], name: "index_payments_on_user_id"
|
13
|
+
|
14
|
+
create_table "users", force: true do |t|
|
15
|
+
t.string "email", default: "", null: false
|
16
|
+
t.string "encrypted_password", default: "", null: false
|
17
|
+
t.string "reset_password_token"
|
18
|
+
t.datetime "reset_password_sent_at"
|
19
|
+
t.datetime "remember_created_at"
|
20
|
+
t.integer "sign_in_count", default: 0, null: false
|
21
|
+
t.datetime "current_sign_in_at"
|
22
|
+
t.datetime "last_sign_in_at"
|
23
|
+
t.string "current_sign_in_ip"
|
24
|
+
t.string "last_sign_in_ip"
|
25
|
+
t.datetime "created_at"
|
26
|
+
t.datetime "updated_at"
|
27
|
+
t.string "stripe_customer_id"
|
28
|
+
end
|
29
|
+
|
30
|
+
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
31
|
+
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
32
|
+
end
|
33
|
+
end
|