authentication-zero 2.8.0 → 2.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -7
- data/lib/authentication_zero/version.rb +1 -1
- data/lib/generators/authentication/authentication_generator.rb +0 -1
- data/lib/generators/authentication/templates/controllers/api/registrations_controller.rb.tt +1 -5
- data/lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt +1 -5
- data/lib/generators/authentication/templates/test_unit/controllers/api/registrations_controller_test.rb.tt +0 -14
- data/lib/generators/authentication/templates/test_unit/controllers/html/registrations_controller_test.rb.tt +0 -14
- data/lib/generators/authentication/templates/test_unit/system/registrations_test.rb.tt +0 -21
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09e4e9fd6a0cb245624984f07b574c17264d6df4cdedd508372153d1d40a860e'
|
4
|
+
data.tar.gz: 1f86f6ffc7590ec45d3b3e9d64cb4fe8042e763b73024adb396c492a92ba7578
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30975f47ce22d6d2ff68cfa17f79831295adfb0938eea4af111fa7d3bef0e7a1c2e35ca3918b8feb5ce874267ac8aae9e231fbcb5ca520b8c51f57da72a8ee30
|
7
|
+
data.tar.gz: 8aee14ca37ef8bdc460ddce3c15f4b785f587625655940752ec23844ee44492ca3026f0eb3769a1468d28af9af653eaf1d2754870a54d45a22d6310e9e89ea0e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -20,7 +20,6 @@ The purpose of authentication zero is to generate a pre-built authentication sys
|
|
20
20
|
- Send e-mail confirmation when your email has been changed
|
21
21
|
- Send e-mail notification when someone has logged into your account
|
22
22
|
- Manage multiple sessions & devices
|
23
|
-
- Cancel my account
|
24
23
|
- Log out
|
25
24
|
|
26
25
|
## Security and best practices
|
@@ -62,20 +61,16 @@ Add these lines to your `app/views/home/index.html.erb`:
|
|
62
61
|
|
63
62
|
<p>Signed as <%= Current.user.email %></p>
|
64
63
|
|
65
|
-
<div>
|
66
|
-
<%= link_to "Change password", edit_password_path %>
|
67
|
-
</div>
|
68
|
-
|
69
64
|
<div>
|
70
65
|
<%= link_to "Change email address", edit_identity_email_path %>
|
71
66
|
</div>
|
72
67
|
|
73
68
|
<div>
|
74
|
-
<%= link_to "
|
69
|
+
<%= link_to "Change password", edit_password_path %>
|
75
70
|
</div>
|
76
71
|
|
77
72
|
<div>
|
78
|
-
<%=
|
73
|
+
<%= link_to "Devices & Sessions", sessions_path %>
|
79
74
|
</div>
|
80
75
|
|
81
76
|
<br>
|
@@ -135,7 +135,6 @@ class AuthenticationGenerator < Rails::Generators::NamedBase
|
|
135
135
|
route "resource :sudo, only: [:new, :create]", namespace: :sessions
|
136
136
|
route "resources :sessions, only: [:index, :show, :destroy]"
|
137
137
|
route "resource :password, only: [:edit, :update]"
|
138
|
-
route "resource :registration, only: :destroy"
|
139
138
|
route "post 'sign_up', to: 'registrations#create'"
|
140
139
|
route "get 'sign_up', to: 'registrations#new'" unless options.api?
|
141
140
|
route "post 'sign_in', to: 'sessions#create'"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class RegistrationsController < ApplicationController
|
2
|
-
skip_before_action :authenticate
|
2
|
+
skip_before_action :authenticate
|
3
3
|
|
4
4
|
def create
|
5
5
|
@<%= singular_table_name %> = <%= class_name %>.new(<%= "#{singular_table_name}_params" %>)
|
@@ -11,10 +11,6 @@ class RegistrationsController < ApplicationController
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
def destroy
|
15
|
-
Current.<%= singular_table_name %>.destroy
|
16
|
-
end
|
17
|
-
|
18
14
|
private
|
19
15
|
def <%= "#{singular_table_name}_params" %>
|
20
16
|
params.permit(:email, :password, :password_confirmation)
|
data/lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class RegistrationsController < ApplicationController
|
2
|
-
skip_before_action :authenticate
|
2
|
+
skip_before_action :authenticate
|
3
3
|
|
4
4
|
def new
|
5
5
|
@<%= singular_table_name %> = <%= class_name %>.new
|
@@ -18,10 +18,6 @@ class RegistrationsController < ApplicationController
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def destroy
|
22
|
-
Current.<%= singular_table_name %>.destroy; redirect_to(sign_in_path, notice: "Your account is closed")
|
23
|
-
end
|
24
|
-
|
25
21
|
private
|
26
22
|
def <%= "#{singular_table_name}_params" %>
|
27
23
|
params.require(:<%= singular_table_name %>).permit(:email, :password, :password_confirmation)
|
@@ -8,18 +8,4 @@ class RegistrationsControllerTest < ActionDispatch::IntegrationTest
|
|
8
8
|
|
9
9
|
assert_response :created
|
10
10
|
end
|
11
|
-
|
12
|
-
test "should destroy account" do
|
13
|
-
@<%= singular_table_name %>, @token = sign_in_as(<%= table_name %>(:lazaro_nixon))
|
14
|
-
|
15
|
-
assert_difference("<%= class_name %>.count", -1) do
|
16
|
-
delete registration_url, headers: { "Authorization" => "Bearer #{@token}" }
|
17
|
-
end
|
18
|
-
|
19
|
-
assert_response :no_content
|
20
|
-
end
|
21
|
-
|
22
|
-
def sign_in_as(<%= singular_table_name %>)
|
23
|
-
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret1*3*5*" }, headers: { "User-Agent" => "App iOS" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
|
24
|
-
end
|
25
11
|
end
|
@@ -13,18 +13,4 @@ class RegistrationsControllerTest < ActionDispatch::IntegrationTest
|
|
13
13
|
|
14
14
|
assert_redirected_to root_url
|
15
15
|
end
|
16
|
-
|
17
|
-
test "should destroy account" do
|
18
|
-
sign_in_as <%= table_name %>(:lazaro_nixon)
|
19
|
-
|
20
|
-
assert_difference("<%= class_name %>.count", -1) do
|
21
|
-
delete registration_url
|
22
|
-
end
|
23
|
-
|
24
|
-
assert_redirected_to sign_in_url
|
25
|
-
end
|
26
|
-
|
27
|
-
def sign_in_as(<%= singular_table_name %>)
|
28
|
-
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret1*3*5*" }, headers: { "User-Agent" => "Firefox" }); <%= singular_table_name %>
|
29
|
-
end
|
30
16
|
end
|
@@ -1,10 +1,6 @@
|
|
1
1
|
require "application_system_test_case"
|
2
2
|
|
3
3
|
class RegistrationsTest < ApplicationSystemTestCase
|
4
|
-
setup do
|
5
|
-
@<%= singular_table_name %> = <%= table_name %>(:lazaro_nixon)
|
6
|
-
end
|
7
|
-
|
8
4
|
test "signing up" do
|
9
5
|
visit sign_up_url
|
10
6
|
|
@@ -15,21 +11,4 @@ class RegistrationsTest < ApplicationSystemTestCase
|
|
15
11
|
|
16
12
|
assert_text "Welcome! You have signed up successfully"
|
17
13
|
end
|
18
|
-
|
19
|
-
test "cancelling my account" do
|
20
|
-
sign_in_as @<%= singular_table_name %>
|
21
|
-
|
22
|
-
click_on "Cancel my account & delete my data"
|
23
|
-
assert_text "Your account is closed"
|
24
|
-
end
|
25
|
-
|
26
|
-
def sign_in_as(<%= singular_table_name %>)
|
27
|
-
visit sign_in_url
|
28
|
-
fill_in :email, with: <%= singular_table_name %>.email
|
29
|
-
fill_in :password, with: "Secret1*3*5*"
|
30
|
-
click_on "Sign in"
|
31
|
-
|
32
|
-
assert_current_path root_url
|
33
|
-
return <%= singular_table_name %>
|
34
|
-
end
|
35
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authentication-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|