authentication-zero 2.2.1 → 2.2.4

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: 6ec32db1ac920db94f1c2350fbf5a98efeca35af8fa8ca1b4f83f1c93190753c
4
+ data.tar.gz: 196b5398bfccab4033f1d9b59897b5afcf2610449b9550e81f008b7c7145fa8a
5
5
  SHA512:
6
- metadata.gz: f050cf8b766989090c9a4c415bdc7f91eebb2ff63b3d7632a5bdfa1923d68ebf6f110d8a2eba71af7387c708c6398ea365746d51fdd45903b1362fd5551588b7
7
- data.tar.gz: 6ec0286f6ea33a9f95551e8808297ab4ffc4d7e609317e5a90c3442c36d7d4c4845bb9746c0e92bea5383ac0ff92f64f652c9453c5b16311ea1eda17b2b96642
6
+ metadata.gz: a551abfb08274802e4422117c5ac30200843bf66a6ee0fcfe6f2fa8dae8ae3e33bdf9d9304af7a60d74d2f3ae3e1a35b76f1988a55a7beaf36dcb53bfec8a0bd
7
+ data.tar.gz: 0ea020f80489a0c5d6e767754543b455b7e986c332fcd8ffea64a38b9f1000629cbb7cb40090c38cd789908d4c6c6590666b295ac9131b86a935f2f48d999195
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.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -4,16 +4,17 @@ 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
+ - **Inspired by hey.com**
8
9
  - Sign up
9
10
  - Email and password validations
10
11
  - Reset the user password and send reset instructions
11
12
  - Reset the user password only from verified emails
12
13
  - Authentication by cookie (html)
13
14
  - 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
15
+ - Send e-mail verification when your email is changed
16
+ - Send e-mail when someone has signed-in into your account
17
+ - Manage multiple sessions & devices
17
18
  - Cancel my account
18
19
  - Log out
19
20
 
@@ -61,17 +62,19 @@ Add these lines to your `app/views/home/index.html.erb`:
61
62
  </div>
62
63
 
63
64
  <div>
64
- <%= link_to "Change email", edit_email_path %>
65
+ <%= link_to "Change email address", edit_email_path %>
65
66
  </div>
66
67
 
67
68
  <div>
68
- <%= link_to "Manage Sessions", sessions_path %>
69
+ <%= link_to "Devices & Sessions", sessions_path %>
69
70
  </div>
70
71
 
71
72
  <div>
72
- <%= button_to "Cancel my account", registration_path, method: :delete %>
73
+ <%= button_to "Cancel my account & delete my data", registration_path, method: :delete %>
73
74
  </div>
74
75
 
76
+ <br>
77
+
75
78
  <%= button_to "Log out", Current.session, method: :delete %>
76
79
  ```
77
80
 
@@ -1,3 +1,3 @@
1
1
  module AuthenticationZero
2
- VERSION = "2.2.1"
2
+ VERSION = "2.2.4"
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
@@ -3,7 +3,7 @@
3
3
  <%% if Current.<%= singular_table_name %>.verified? %>
4
4
  <h1>Change your email</h1>
5
5
  <%% else %>
6
- <h1>Verify your email </h1>
6
+ <h1>Verify your email</h1>
7
7
  <p>We sent a verification email to the address below. Check that email and follow those instructions to confirm it's your email address.</p>
8
8
  <p><%%= button_to "Re-send verification email", email_verification_path %></p>
9
9
  <%% end %>
@@ -1,6 +1,6 @@
1
1
  <p style="color: green"><%%= notice %></p>
2
2
 
3
- <h1>Sessions</h1>
3
+ <h1>Devices & Sessions</h1>
4
4
 
5
5
  <div id="sessions">
6
6
  <%% @sessions.each do |session| %>
@@ -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
@@ -6,7 +6,7 @@ class EmailsTest < ApplicationSystemTestCase
6
6
  end
7
7
 
8
8
  test "updating the email" do
9
- click_on "Change email"
9
+ click_on "Change email address"
10
10
 
11
11
  fill_in "Current password", with: "secret123"
12
12
  fill_in "New email", with: "new_email@hey.com"
@@ -18,7 +18,7 @@ class EmailsTest < ApplicationSystemTestCase
18
18
  test "sending a verification email" do
19
19
  @<%= singular_table_name %>.update! verified: false
20
20
 
21
- click_on "Change email"
21
+ click_on "Change email address"
22
22
  click_on "Re-send verification email"
23
23
 
24
24
  assert_text "We sent a verification email to your email address"
@@ -19,7 +19,7 @@ class RegistrationsTest < ApplicationSystemTestCase
19
19
 
20
20
  test "cancelling my account" do
21
21
  sign_in_as @<%= singular_table_name %>
22
- click_on "Cancel my account"
22
+ click_on "Cancel my account & delete my data"
23
23
 
24
24
  assert_text "Your account is closed"
25
25
  end
@@ -8,7 +8,7 @@ class SessionsTest < ApplicationSystemTestCase
8
8
  test "visiting the index" do
9
9
  sign_in_as @<%= singular_table_name %>
10
10
 
11
- click_on "Manage Sessions"
11
+ click_on "Devices & Sessions"
12
12
  assert_selector "h1", text: "Sessions"
13
13
  end
14
14
 
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.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nixon