authentication-zero 2.2.1 → 2.2.2

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
  SHA256:
3
- metadata.gz: ed9892e61478e60ca189e6e835b59c9fd2ab63e2c342e1d67bbdfb57f60dd9ba
4
- data.tar.gz: d890089e13104ec641c5d26ec5541e3ce9a4cb64cbe2d2276347f0c328efc713
3
+ metadata.gz: ebc9ddc7618fcddba8022355329e17c9c2c57cef7a0fc01841f9a81a2aa2d02f
4
+ data.tar.gz: 3c3c7f689a728dd430619b20e9436576e70bae5b8d0eb7846d604101cbe14de3
5
5
  SHA512:
6
- metadata.gz: f050cf8b766989090c9a4c415bdc7f91eebb2ff63b3d7632a5bdfa1923d68ebf6f110d8a2eba71af7387c708c6398ea365746d51fdd45903b1362fd5551588b7
7
- data.tar.gz: 6ec0286f6ea33a9f95551e8808297ab4ffc4d7e609317e5a90c3442c36d7d4c4845bb9746c0e92bea5383ac0ff92f64f652c9453c5b16311ea1eda17b2b96642
6
+ metadata.gz: 1d8d013ce1b98fc3103c3259de61a12550b4c54628f2d246bd45fbd90d464322869330c3d8ade099600a87aa58f10f4fa02d289ca3a71db4772f4242d2ee2933
7
+ data.tar.gz: 464a5dad30c894bf3a3b5db0637589efff8b7cfbfe41190c4b40826365529f617c3b7e7ed977fef85294a133107445f3d4e35e0a3aea84882a548f1f85bd8502
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- authentication-zero (2.2.1)
4
+ authentication-zero (2.2.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -4,16 +4,16 @@ The purpose of authentication zero is to generate a pre-built authentication sys
4
4
 
5
5
  ## Features
6
6
 
7
- - **Simplest code ever**
7
+ - **Simplest code ever (~200 lines of code)**
8
8
  - Sign up
9
9
  - Email and password validations
10
10
  - Reset the user password and send reset instructions
11
11
  - Reset the user password only from verified emails
12
12
  - Authentication by cookie (html)
13
13
  - Authentication by token (api)
14
- - Send e-mail verification when change your email
15
- - Send e-mail when sign-in to your account
16
- - Manage multiple sessions
14
+ - Send e-mail verification when your email is changed
15
+ - Send e-mail when someone has signed-in into your account
16
+ - Manage multiple sessions & devices
17
17
  - Cancel my account
18
18
  - Log out
19
19
 
@@ -1,3 +1,3 @@
1
1
  module AuthenticationZero
2
- VERSION = "2.2.1"
2
+ VERSION = "2.2.2"
3
3
  end
@@ -9,7 +9,10 @@ class RegistrationsController < ApplicationController
9
9
  @<%= singular_table_name %> = <%= class_name %>.new(<%= "#{singular_table_name}_params" %>)
10
10
 
11
11
  if @<%= singular_table_name %>.save
12
- redirect_to sign_in_path, notice: "Welcome! You have signed up successfully"
12
+ session = @<%= singular_table_name %>.sessions.create!(session_params)
13
+ cookies.signed.permanent[:session_token] = { value: session.id, httponly: true }
14
+
15
+ redirect_to root_path, notice: "Welcome! You have signed up successfully"
13
16
  else
14
17
  render :new, status: :unprocessable_entity
15
18
  end
@@ -24,4 +27,8 @@ class RegistrationsController < ApplicationController
24
27
  def <%= "#{singular_table_name}_params" %>
25
28
  params.require(:<%= singular_table_name %>).permit(:email, :password, :password_confirmation)
26
29
  end
30
+
31
+ def session_params
32
+ { user_agent: request.user_agent, ip_address: request.remote_ip }
33
+ end
27
34
  end
@@ -15,8 +15,8 @@ class SessionsController < ApplicationController
15
15
  @<%= singular_table_name %> = <%= class_name %>.find_by_email(params[:email])
16
16
 
17
17
  if @<%= singular_table_name %>.try(:authenticate, params[:password])
18
- @session = @<%= singular_table_name %>.sessions.create!(session_params)
19
- cookies.signed.permanent[:session_token] = { value: @session.id, httponly: true }
18
+ session = @<%= singular_table_name %>.sessions.create!(session_params)
19
+ cookies.signed.permanent[:session_token] = { value: session.id, httponly: true }
20
20
 
21
21
  redirect_to root_path, notice: "Signed in successfully"
22
22
  else
@@ -11,7 +11,7 @@ class RegistrationsControllerTest < ActionDispatch::IntegrationTest
11
11
  post sign_up_url, params: { <%= singular_table_name %>: { email: "lazaronixon@hey.com", password: "secret123", password_confirmation: "secret123" } }
12
12
  end
13
13
 
14
- assert_redirected_to sign_in_url
14
+ assert_redirected_to root_url
15
15
  end
16
16
 
17
17
  test "should destroy account" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authentication-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nixon