knock_once 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e1ee1a4bfcaa9e4488162846e441581bb26c26e
4
- data.tar.gz: 21858d81ee43780b5df9cdd4edeed77596e02d20
3
+ metadata.gz: a6b19f4ce7b6ecf6860cb9aee3b2af98081f49ee
4
+ data.tar.gz: e1a5b63432a06499ed5c0d80dfc7b675d6ec9b76
5
5
  SHA512:
6
- metadata.gz: ab78c146dc10fdfff5bf338bf56a34dbcb78b26a8106e91228ca5d5ce5ad8d2bc70764e45367ecc5124acb58dadc6932e8a454f1e82b3f504eb3f3936b4d0f62
7
- data.tar.gz: 5e26f6aafe38cb4b0e9cd66fe965ecdc6225f2878c6aa571f2507cddd165a1f64ab364de5f887c2a0979da7aed533a57a5eb98c6ec750ffdf3712f0329aaeb9f
6
+ metadata.gz: 94cb28e74d99f01fd89f8c141ce9d5eb9849b109eb8505b5a6bf8e0563fb5256e910074630629edb7cdce978e4deddb52c48af1595fdc8ab8d357ae69a98943a
7
+ data.tar.gz: c03af0c55fe402d1c127eeeafaa1dff2209b0cb5a5f371357810b6ee9783e6d4a729df3290c81a5adbf5a9c8fd2c1d6a8088f0795fa8d347e9d49b253696ba8b
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # KnockOnce
2
- knock_once is a user auth gem built on top of [knock](https://github.com/nsarno/knock). The goals of knock_once are twofold:
3
- * Provide the minimum functionality required to register, authenticate, and reset user passwords. In this sense, minimum means only basic functionality which should apply to the largest number of users.
2
+ knock_once is a user auth gem built on top of [knock](https://github.com/nsarno/knock) to provide a basic JWT user auth system for APIs. The goals of knock_once are twofold:
3
+ * Provide the minimum functionality required to register, authenticate, and reset user passwords.
4
4
  * Provide easy extensibility and customization. Because the first goal is to provide only basic auth, it's expected that all or most users will want to add or modify functionality and development choices in this gem should be made with this in mind.
5
5
 
6
6
  Though it is not released now, it is planned to have additional functionality available either here or through additional gems (e.g. confirming users, lockable accounts...). The goal here is to provide much of the functionality available in other packages, such as [devise](https://github.com/plataformatec/devise) and [devise_token_auth](https://github.com/lynndylanhurley/devise_token_auth), using JWT.
@@ -25,19 +25,188 @@ $ gem install knock_once
25
25
  Mount the gem in our `routes.rb` file:
26
26
 
27
27
  ```ruby
28
- mount KnockOnce::Engine, at: '/auth'
28
+ mount KnockOnce::Engine, at: '/auth' # Can mount at whatever path you like
29
29
  ```
30
30
 
31
- Then run generators to generate migration
31
+ Then run generators and include the name for your user model
32
32
  ```
33
- rails g knock_once:install
33
+ rails g knock_once:install [User]
34
34
  ```
35
35
 
36
+ ## Setting up
37
+ After you run the install generator, you will have a user model, user migration and an initialization file. You only need to run `rails db:migrate` to get started, but realistically your user model will have more information than just an email. Add your additional user fields to the migration (and any validations etc you need for them on the model) and then whitelist the required user params in the initializer.
38
+
39
+ ### Require user auth on a controller
40
+ You have access to the `authenticate_user` method via the `knock` gem. The easiest way to incorporate this is to include the module in your application controller:
41
+ ```
42
+ class ApplicationController < ActionController::API
43
+ include Knock::Authenticable
44
+ end
45
+ ```
46
+
47
+ Then you can add the standard before action on each controller you would like to require authentication for: `before_action :authenticate_user`
48
+
49
+ ## User
50
+
51
+
52
+ ### User validations
53
+ knock_once has basic user validation for the following fields:
54
+
55
+ * email: must be unique, less than 255 characters and conform to a very basic regext test
56
+ * password: must be at least 8 characters
57
+ *Note:* Password is allowed to be nil on update, but enforced for changes on the controller, so if you decide to override either the user or passwords_controller you can update attributes without changing this validation on the model.
58
+ * password_digest: must be present (fails if you forget to pass a `password_confirmation` on registration)
59
+
60
+ If you would like to add additional validations, you can do so directly inside the `user.rb` file that is created by the generator.
61
+
62
+ ### User endpoints
63
+ User endpoints are avalailable under `#{mount_path}/users` with the exception of retrieving a token, which is available under `#{mount_path}/user_token`. For example, if you have mounted the engine at `auth` then your user show action is at `/auth/users`.
64
+
65
+ *Note:* for the rest of the examples it is assumed that you have mounted the engine at `auth`.
66
+
67
+ #### Registering a new user
68
+ To register a new user `POST` to `/auth/users` with the information required by your application. At a minimum, user registration must include an `email`, `password` and `password confirmation`.
69
+
70
+ Example:
71
+ ```
72
+ {
73
+ "email": "exampleuser@example.com",
74
+ "password": "password",
75
+ "password_confirmation": "password"
76
+ }
77
+ ```
78
+
79
+ #### Get user token (Login)
80
+ To get a new user token `POST` the user `email` and `password` to `auth/user_token`.
81
+
82
+ Example:
83
+ ```
84
+ {
85
+ "auth": {
86
+ "email": "firstuser@example.com",
87
+ "password": "password"
88
+ }
89
+ }
90
+ ```
91
+
92
+ #### Returning user info in user token
93
+ By default `knock_once` will only return the user's id and email address when user information is encoded in the token (on login, create token and get user). To overwrite this add the method `to_token_payload` to the `user.rb` model that was created by the generator and define the values you would like to return.
94
+ Example:
95
+
96
+ ```ruby
97
+ def to_token_payload
98
+ {
99
+ sub: id,
100
+ email: email,
101
+ user_name: user_name,
102
+ image: image
103
+ }
104
+ end
105
+ ```
106
+
107
+ #### Get user
108
+ The default show action returns the current user based on the token passed. To retrieve current user information `GET` to `/auth/users` with a valid authorization token.
109
+
110
+ If you would like to retrieve other users, you can add a controller action and route. If you choose to have this controller inherit from `KnockOnce::UsersController` then there is no need to call `authenticate_user` as it is already called in the engine. A very basic example would be:
111
+
112
+ `app/controller/users_controller.rb`
113
+ ```ruby
114
+ class UsersController < KnockOnce::UsersController
115
+ def show
116
+ @user = User.find(params[:id])
117
+ render json: @user
118
+ end
119
+ end
120
+ ```
121
+
122
+ `config/routes.rb`
123
+ ```ruby
124
+ Rails.application.routes.draw do
125
+ mount KnockOnce::Engine, at: '/auth'
126
+
127
+ post '/users', to: 'users#show'
128
+ end
129
+ ```
130
+
131
+ #### Updating a user
132
+ To update a user attribute(s), `PATCH` or `PUT` to `/auth/users` with a valid token, the `current_password` and the updated attributes.
133
+
134
+ Example:
135
+ ```
136
+ {
137
+ "current_password": "password",
138
+ "email": "newemail@example.com"
139
+ }
140
+ ```
141
+
142
+ *Note:* You will need to strip empty fields on the front end. If you pass empty strings as values, they will save as those values (with the exception of `email` which will fail validation).
143
+
144
+ *Note:* To change a user password, see the passwords section below.
145
+
146
+ #### Deleting a user
147
+ To delete a user `DELETE` to `/auth/users` with a valid token and the current password.
148
+
149
+ Example:
150
+ ```
151
+ {
152
+ "current_password": "password",
153
+ }
154
+ ```
155
+
156
+ ### Passwords
157
+ Password changes and the forgot password flow are handled by the passwords controller. The passwords controller, like the users controller, enforces that a current password is passed to update. This behavior will be customizable in the future.
158
+
159
+ #### Updating a user password (when the user knows their current password)
160
+ To update a user password `PATCH` or `PUT` to `/auth/passwords` with a valid authorization token, the `current_password`, the desired new `password` and a matching `password_confirmation`.
161
+
162
+ Example:
163
+ ```
164
+ {
165
+ "current_password": "password",
166
+ "password": "newpassword",
167
+ "password_confirmation": "newpassword"
168
+ }
169
+ ```
170
+
171
+ ### Forgot password flow
172
+ To allow the user to reset their password `POST` a valid email to `/auth/passwords/reset`. This will trigger an email which has a token. To select a new password the token must be passed with a `PATCH` or `PUT` to `/auth/passwords/reset` along with a `token`, `password` and `password_confirmation`. There is also a convenience method avalable at `/auth/passwords/validate` which will return an empty `202` if the token passed to it is valid (this though is the only function, it does not reset passwords or invalidate tokens; it only validates that they exist in the database).
173
+
174
+ #### Creating a token
175
+ To create a token simply `POST` to `/auth/passwords/reset` with a valid email address. As a security precaution, the server will return `200` and a non-commital message regardless of whether the email is registered.
176
+
177
+ Password Reset tokens are good for 1 hour by default. This can be customized in the initializer.
178
+
179
+ #### Updating password with token
180
+ To reset a user password with a valid reset token `PATCH` or `PUT` to `/auth/passwords/reset` with the `token`, a `password` and `password_confirmation`.
181
+
182
+ Example:
183
+ ```
184
+ {
185
+ "token": "t7wHptqkZIGAirwdq5Ubt_rx",
186
+ "password": "newpassword",
187
+ "password_confirmation": "newpassword"
188
+ }
189
+ ```
190
+
191
+ #### Validation endpoint
192
+ If you would like to check if a user token is valid (e.g. you are making them enter a pin or copy a token from an email) you can `POST` to `/auth/passwords/validate` with a `token`. This will return an empty `202` on success and `404` on failure.
193
+
36
194
  ## Current state
37
- The gem has been extracted from a test project and as such has very little configurability (but it works at least within those parameters). The primary next steps are to add user configuration options, additional documentation, add tests for current functionality and improve the generators.
195
+ The gem has been extracted from a test project and as such has only limited configurability (but it works at least within those parameters). The primary next steps are to add user configuration options, additional documentation, add tests for current functionality and improve the generators.
38
196
 
39
197
  ## Contributing
40
198
  Pull requests are very welcome.
41
199
 
200
+ Current list of items that I would like to add to the gem
201
+
202
+ * Tests! The current test suite needs work. Please see [CONTRIBUTING](https://github.com/nicholasshirley/knock_once/contributing.md) for the current test strategy.
203
+ * Initializer that lets user app decide when to require password for on update. Currently the default is for any changes to the user and to change password
204
+ * Initializer + code changes to let users set password recovery method (e.g. token vs pin), length
205
+ * Initializer + code changes to customize what is required on delete (default is a valid token only)
206
+ * Forgot password mail template that generate based on the choosen strategy (e.g. reset link, email token, pin reset...) and the initializers to suppor this
207
+ * Hook into knock initializer so that users can customize those options from the knock_once initializer file
208
+
209
+ Please see [CONTRIBUTING](https://github.com/nicholasshirley/knock_once/contributing.md) for specicifics.
210
+
42
211
  ## License
43
212
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -14,23 +14,9 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
- APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
18
  load 'rails/tasks/engine.rake'
19
19
 
20
-
21
20
  load 'rails/tasks/statistics.rake'
22
21
 
23
-
24
-
25
22
  require 'bundler/gem_tasks'
26
-
27
- require 'rake/testtask'
28
-
29
- Rake::TestTask.new(:test) do |t|
30
- t.libs << 'test'
31
- t.pattern = 'test/**/*_test.rb'
32
- t.verbose = false
33
- end
34
-
35
-
36
- task default: :test
@@ -10,8 +10,10 @@ module KnockOnce
10
10
  # if valid user
11
11
  if @user
12
12
  # generate a new token and save
13
- Password.save_token_and_expiry(@user)
14
- Password.email_reset(@user.email)
13
+ password = Password.new(@user)
14
+ password.email_reset
15
+ password.save_token_and_expiry
16
+
15
17
  render status: 200, json: {
16
18
  message: 'Your request has been received. If we have an email matching that account you will receive link to reset your password.'
17
19
  }
@@ -1,4 +1,4 @@
1
- require_dependency "knock_once/application_controller"
1
+ require_dependency 'knock_once/application_controller'
2
2
 
3
3
  module KnockOnce
4
4
  class UsersController < ApplicationController
@@ -11,7 +11,7 @@ module KnockOnce
11
11
  end
12
12
 
13
13
  def update
14
- @user = current_user
14
+ @user = User.find_by_id(current_user.id)
15
15
  if @user.authenticate(params[:current_password])
16
16
  if @user.update(user_params)
17
17
  render json: {
@@ -28,10 +28,14 @@ module KnockOnce
28
28
 
29
29
  def destroy
30
30
  @user = current_user
31
- if @user.destroy
32
- render json: :success
31
+ if @user.authenticate(params[:current_password])
32
+ if @user.destroy
33
+ render json: :success
34
+ else
35
+ render json: @user.errors.full_messages
36
+ end
33
37
  else
34
- render json: @user.errors.full_messages
38
+ render status: :unprocessable_entity, json: ['Current password is incorrect']
35
39
  end
36
40
  end
37
41
 
@@ -47,7 +51,7 @@ module KnockOnce
47
51
  private
48
52
 
49
53
  def user_params
50
- params.permit(:user, :user_name, :email, :current_password, :password, :password_confirmation)
54
+ params.permit(KnockOnce.configuration.user_params)
51
55
  end
52
56
  end
53
57
  end
@@ -1,14 +1,14 @@
1
1
  module KnockOnce
2
2
  class PasswordResetMailer < ApplicationMailer
3
- default from: 'no-reply@sporkbook.com'
3
+ default from: 'no-reply@your_app_name_here.com'
4
4
 
5
5
  def password_reset(user, token)
6
6
  @user = user
7
7
  @token = token
8
8
 
9
9
  mail(
10
- to: @user,
11
- subject: 'Forgot password request from SporkBook')
10
+ to: @user.email,
11
+ subject: 'Forgot password request')
12
12
  end
13
13
  end
14
14
  end
@@ -1,19 +1,19 @@
1
1
  module KnockOnce
2
- class Password < ApplicationRecord
3
- attr_accessor :token
4
- attr_accessor :user
2
+ class Password
5
3
 
6
- def self.generate_reset_token
7
- @token = SecureRandom.urlsafe_base64(18, false)
8
- end
4
+ attr_accessor :token, :user
9
5
 
10
- def self.save_token_and_expiry(user)
6
+ def initialize(user)
7
+ @token = SecureRandom.urlsafe_base64(KnockOnce.configuration.reset_token_length, false)
11
8
  @user = user
12
- generate_reset_token
13
- User.find_by_email(@user['email']).update_attributes(password_reset_token: @token, password_token_expiry: 1.hour.from_now)
14
9
  end
15
10
 
16
- def self.email_reset(email)
11
+ def save_token_and_expiry
12
+ User.find_by_email(@user['email'])
13
+ .update_attributes(password_reset_token: @token, password_token_expiry: KnockOnce.configuration.password_token_expiry)
14
+ end
15
+
16
+ def email_reset
17
17
  PasswordResetMailer.password_reset(@user, @token).deliver_now
18
18
  end
19
19
  end
@@ -10,9 +10,5 @@
10
10
 
11
11
  <h2><%= @token %></h2>
12
12
  </p>
13
-
14
- <H2>
15
- <a href="http://localhost:8080/#/reset">Click here to reset your password</a>
16
- </H2>
17
13
  </body>
18
14
  </html>
@@ -2,17 +2,30 @@ module KnockOnce
2
2
  class InstallGenerator < Rails::Generators::Base
3
3
  include Rails::Generators::Migration
4
4
 
5
- source_root File.expand_path("../../../templates", __FILE__)
5
+ argument :user_class, type: :string, default: "User"
6
6
 
7
+ source_root File.expand_path('../../../templates', __FILE__)
8
+
9
+ # Copy initializer into user app
10
+ def copy_initializer
11
+ copy_file('create_initializer.rb', 'config/initializers/knock_once.rb')
12
+ end
13
+
14
+ # Copy user information (model & Migrations) into user app
7
15
  def create_user_model
8
- copy_file('user_model.rb', 'app/models/user.rb')
16
+ fname = "app/models/#{user_class.underscore}.rb"
17
+ unless File.exist?(File.join(destination_root, fname))
18
+ template("user_model.rb", fname)
19
+ else
20
+ say_status('skipped', "Model #{user_class.underscore} already exists")
21
+ end
9
22
  end
10
23
 
11
24
  def copy_migrations
12
- if self.class.migration_exists?("db/migrate", "create_knock_once_users")
13
- say_status("skipped", "Migration create_knock_once_users already exists")
25
+ if self.class.migration_exists?('db/migrate', "create_knock_once_#{user_class.underscore}")
26
+ say_status('skipped', "Migration create_knock_once_#{user_class.underscore} already exists")
14
27
  else
15
- migration_template("create_knock_once_users.rb.erb", "db/migrate/create_knock_once_users.rb")
28
+ migration_template('create_knock_once_users.rb.erb', "db/migrate/create_knock_once_#{user_class.pluralize.underscore}.rb")
16
29
  end
17
30
  end
18
31
 
@@ -1,5 +1,27 @@
1
1
  require "knock_once/engine"
2
2
 
3
3
  module KnockOnce
4
- # Your code goes here...
4
+ class Configuration
5
+ attr_accessor :user_params
6
+ attr_accessor :password_token_expiry
7
+ attr_accessor :reset_token_length
8
+
9
+ def initialize
10
+ @user_params = :user, :email, :current_password, :password, :password_confirmation
11
+ @password_token_expiry = 1.hour.from_now
12
+ @reset_token_length = 18
13
+ end
14
+ end
15
+
16
+ def self.configuration
17
+ @configuration ||= Configuration.new
18
+ end
19
+
20
+ def self.configuration=(config)
21
+ @configuration = config
22
+ end
23
+
24
+ def self.configure
25
+ yield configuration
26
+ end
5
27
  end
@@ -4,5 +4,9 @@ module KnockOnce
4
4
  class Engine < ::Rails::Engine
5
5
  isolate_namespace KnockOnce
6
6
  config.generators.api_only = true
7
+
8
+ config.generators do |g|
9
+ g.test_framework :rspec
10
+ end
7
11
  end
8
12
  end
@@ -1,3 +1,3 @@
1
1
  module KnockOnce
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
@@ -0,0 +1,20 @@
1
+ KnockOnce.configure do |config|
2
+
3
+ # WHITELIST USER PARAMS
4
+
5
+ # By default knock_once will whitelist :user, :email, :current_password
6
+ # :password, :password_confirmation
7
+ # To add your own params push them into the user_param array. Example:
8
+ # config.user_params.push(:user_name)
9
+
10
+ # PASSWORD RESET OPTIONS
11
+
12
+ # Reset token validity
13
+ # By default password tokens will only be valid for one hour.
14
+ # config.password_token_expiry = 1.hour.from_now
15
+
16
+ # Reset token length
17
+ # By default the reset token length is 18
18
+ # config.reset_token_length = 18
19
+
20
+ end
@@ -1,6 +1,6 @@
1
- class CreateKnockOnceUsers < ActiveRecord::Migration<%= "[#{Rails::VERSION::STRING[0..2]}]" if Rails::VERSION::MAJOR > 4 %>
1
+ class CreateKnockOnce<%= user_class.pluralize %> < ActiveRecord::Migration<%= "[#{Rails::VERSION::STRING[0..2]}]" if Rails::VERSION::MAJOR > 4 %>
2
2
  def change
3
- create_table :users do |t|
3
+ create_table :<%= user_class.pluralize %> do |t|
4
4
  # Required
5
5
  t.string :email
6
6
  t.string :password_digest
@@ -13,6 +13,6 @@ class CreateKnockOnceUsers < ActiveRecord::Migration<%= "[#{Rails::VERSION::STRI
13
13
  t.timestamps
14
14
  end
15
15
 
16
- add_index :users, :email, unique: true
16
+ add_index <%= user_class.pluralize %>, :email, unique: true
17
17
  end
18
18
  end
@@ -1,3 +1,3 @@
1
- class User < KnockOnce::User
1
+ class <%= user_class.capitalize %> < KnockOnce::User
2
2
 
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knock_once
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Shirley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-13 00:00:00.000000000 Z
11
+ date: 2017-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,56 +16,98 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 5.1.4
19
+ version: '5.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 5.1.4
26
+ version: '5.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: knock
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '2.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '2.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sqlite3
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '1.3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '1.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pg
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.21'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.21'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '0'
75
+ version: '3'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ">="
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: database_cleaner
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.6'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: factory_bot_rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '4'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
67
109
  - !ruby/object:Gem::Version
68
- version: '0'
110
+ version: '4'
69
111
  description: knock_once provides basic user email auth using knock.
70
112
  email:
71
113
  - nicholas@reallymy.email
@@ -83,13 +125,10 @@ files:
83
125
  - app/jobs/knock_once/application_job.rb
84
126
  - app/mailers/knock_once/application_mailer.rb
85
127
  - app/mailers/knock_once/password_reset_mailer.rb
86
- - app/mailers/knock_once/user_mailer.rb
87
128
  - app/models/knock_once/application_record.rb
88
129
  - app/models/knock_once/password.rb
89
130
  - app/models/knock_once/user.rb
90
131
  - app/views/knock_once/password_reset_mailer/password_reset.html.erb
91
- - app/views/knock_once/user_mailer/welcome_mailer.html.erb
92
- - app/views/knock_once/user_mailer/welcome_mailer.text.erb
93
132
  - app/views/layouts/knock_once/mailer.html.erb
94
133
  - app/views/layouts/knock_once/mailer.text.erb
95
134
  - config/initializers/knock.rb
@@ -99,6 +138,7 @@ files:
99
138
  - lib/knock_once/engine.rb
100
139
  - lib/knock_once/version.rb
101
140
  - lib/tasks/knock_once_tasks.rake
141
+ - lib/templates/create_initializer.rb
102
142
  - lib/templates/create_knock_once_users.rb.erb
103
143
  - lib/templates/user_model.rb
104
144
  homepage: https://github.com/nicholasshirley/knock_once
@@ -1,12 +0,0 @@
1
- module KnockOnce
2
- class UserMailer < ApplicationMailer
3
- def welcome_mailer(user)
4
- @user = user
5
- mail(to: @user.email,
6
- subject: 'Welcome to Sporkbook!') do |format|
7
- format.html { render 'welcome_mailer' }
8
- format.text { render 'welcome_mailer' }
9
- end
10
- end
11
- end
12
- end
@@ -1 +0,0 @@
1
- Welcome <%= @user.email %>!
@@ -1 +0,0 @@
1
- Welcome <%= @user.email %>!