authentication-zero 2.16.27 → 2.16.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/authentication_zero/version.rb +1 -1
- data/lib/generators/authentication/authentication_generator.rb +3 -3
- data/lib/generators/authentication/templates/controllers/api/application_controller.rb.tt +2 -2
- data/lib/generators/authentication/templates/controllers/html/application_controller.rb.tt +2 -2
- data/lib/generators/authentication/templates/controllers/html/masquerades_controller.rb.tt +2 -2
- data/lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt +2 -2
- data/lib/generators/authentication/templates/controllers/html/sessions/omniauth_controller.rb.tt +2 -2
- data/lib/generators/authentication/templates/controllers/html/sessions/passwordlesses_controller.rb.tt +2 -2
- data/lib/generators/authentication/templates/controllers/html/sessions/sudos_controller.rb.tt +3 -3
- data/lib/generators/authentication/templates/controllers/html/two_factor_authentication/challenge/recovery_codes_controller.rb.tt +2 -2
- data/lib/generators/authentication/templates/controllers/html/two_factor_authentication/challenge/security_keys_controller.rb.tt +2 -2
- data/lib/generators/authentication/templates/controllers/html/two_factor_authentication/challenge/totps_controller.rb.tt +2 -2
- 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: b1ca404e21064ef6548cb7fd3dd0d62259e55cc1712ccbd37266de5a5009cae4
|
4
|
+
data.tar.gz: 5470a05b5863a993997d9cc17d7c104d53ed5f8277182f029f9831e8c51be6fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 044747617b27c4a38aae36572364ce3e64483fe15a7ca44518209e1db30a2207269b92edb28ce690449249c728073d5d661eb4df15a19afa8cceeaa20eb763fd
|
7
|
+
data.tar.gz: 47ed5cb9bcef11dfc71a4ed3c761b5a30d346c0b1923e52f1e71f24d5c1703b23b7e52552cd12f7ca9ad6e9031d3cc8a6a5e4a124e0d3a8f6753fdbea202cd13
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -62,14 +62,14 @@ class AuthenticationGenerator < Rails::Generators::Base
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def create_migrations
|
65
|
+
migration_template "migrations/create_users_migration.rb", "#{db_migrate_path}/create_users.rb"
|
66
|
+
migration_template "migrations/create_sessions_migration.rb", "#{db_migrate_path}/create_sessions.rb"
|
67
|
+
migration_template "migrations/create_password_reset_tokens_migration.rb", "#{db_migrate_path}/create_password_reset_tokens.rb"
|
65
68
|
migration_template "migrations/create_email_verification_tokens_migration.rb", "#{db_migrate_path}/create_email_verification_tokens.rb"
|
66
69
|
migration_template "migrations/create_events_migration.rb", "#{db_migrate_path}/create_events.rb" if options.trackable?
|
67
|
-
migration_template "migrations/create_password_reset_tokens_migration.rb", "#{db_migrate_path}/create_password_reset_tokens.rb"
|
68
70
|
migration_template "migrations/create_recovery_codes_migration.rb", "#{db_migrate_path}/create_recovery_codes.rb" if two_factor?
|
69
71
|
migration_template "migrations/create_security_keys_migration.rb", "#{db_migrate_path}/create_security_keys.rb" if webauthn?
|
70
|
-
migration_template "migrations/create_sessions_migration.rb", "#{db_migrate_path}/create_sessions.rb"
|
71
72
|
migration_template "migrations/create_sign_in_tokens_migration.rb", "#{db_migrate_path}/create_sign_in_tokens_migration.rb" if passwordless?
|
72
|
-
migration_template "migrations/create_users_migration.rb", "#{db_migrate_path}/create_users.rb"
|
73
73
|
end
|
74
74
|
|
75
75
|
def create_models
|
@@ -6,8 +6,8 @@ class ApplicationController < ActionController::API
|
|
6
6
|
|
7
7
|
private
|
8
8
|
def authenticate
|
9
|
-
if
|
10
|
-
Current.session =
|
9
|
+
if session_record = authenticate_with_http_token { |token, _| Session.find_signed(token) }
|
10
|
+
Current.session = session_record
|
11
11
|
else
|
12
12
|
request_http_token_authentication
|
13
13
|
end
|
@@ -4,8 +4,8 @@ class ApplicationController < ActionController::Base
|
|
4
4
|
|
5
5
|
private
|
6
6
|
def authenticate
|
7
|
-
if
|
8
|
-
Current.session =
|
7
|
+
if session_record = Session.find_by_id(cookies.signed[:session_token])
|
8
|
+
Current.session = session_record
|
9
9
|
else
|
10
10
|
redirect_to sign_in_path
|
11
11
|
end
|
@@ -3,8 +3,8 @@ class MasqueradesController < ApplicationController
|
|
3
3
|
before_action :set_user
|
4
4
|
|
5
5
|
def create
|
6
|
-
|
7
|
-
cookies.signed.permanent[:session_token] = { value:
|
6
|
+
session_record = @user.sessions.create!
|
7
|
+
cookies.signed.permanent[:session_token] = { value: session_record.id, httponly: true }
|
8
8
|
|
9
9
|
redirect_to root_path, notice: "Signed in successfully"
|
10
10
|
end
|
data/lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
CHANGED
@@ -9,8 +9,8 @@ class RegistrationsController < ApplicationController
|
|
9
9
|
@user = User.new(user_params)
|
10
10
|
|
11
11
|
if @user.save
|
12
|
-
|
13
|
-
cookies.signed.permanent[:session_token] = { value:
|
12
|
+
session_record = @user.sessions.create!
|
13
|
+
cookies.signed.permanent[:session_token] = { value: session_record.id, httponly: true }
|
14
14
|
|
15
15
|
send_email_verification
|
16
16
|
redirect_to root_path, notice: "Welcome! You have signed up successfully"
|
data/lib/generators/authentication/templates/controllers/html/sessions/omniauth_controller.rb.tt
CHANGED
@@ -6,8 +6,8 @@ class Sessions::OmniauthController < ApplicationController
|
|
6
6
|
@user = User.create_with(user_params).find_or_initialize_by(omniauth_params)
|
7
7
|
|
8
8
|
if @user.save
|
9
|
-
|
10
|
-
cookies.signed.permanent[:session_token] = { value:
|
9
|
+
session_record = @user.sessions.create!
|
10
|
+
cookies.signed.permanent[:session_token] = { value: session_record.id, httponly: true }
|
11
11
|
|
12
12
|
redirect_to root_path, notice: "Signed in successfully"
|
13
13
|
else
|
@@ -10,8 +10,8 @@ class Sessions::PasswordlessesController < ApplicationController
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def edit
|
13
|
-
|
14
|
-
cookies.signed.permanent[:session_token] = { value:
|
13
|
+
session_record = @user.sessions.create!
|
14
|
+
cookies.signed.permanent[:session_token] = { value: session_record.id, httponly: true }
|
15
15
|
|
16
16
|
revoke_tokens; redirect_to(root_path, notice: "Signed in successfully")
|
17
17
|
end
|
data/lib/generators/authentication/templates/controllers/html/sessions/sudos_controller.rb.tt
CHANGED
@@ -3,10 +3,10 @@ class Sessions::SudosController < ApplicationController
|
|
3
3
|
end
|
4
4
|
|
5
5
|
def create
|
6
|
-
|
6
|
+
session_record = Current.session
|
7
7
|
|
8
|
-
if
|
9
|
-
|
8
|
+
if session_record.user.authenticate(params[:password])
|
9
|
+
session_record.sudo.mark; redirect_to(params[:proceed_to_url])
|
10
10
|
else
|
11
11
|
redirect_to new_sessions_sudo_path(proceed_to_url: params[:proceed_to_url]), alert: "The password you entered is incorrect"
|
12
12
|
end
|
@@ -22,8 +22,8 @@ class TwoFactorAuthentication::Challenge::RecoveryCodesController < ApplicationC
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def sign_in_and_redirect_to_root
|
25
|
-
|
26
|
-
cookies.signed.permanent[:session_token] = { value:
|
25
|
+
session_record = @user.sessions.create!
|
26
|
+
cookies.signed.permanent[:session_token] = { value: session_record.id, httponly: true }
|
27
27
|
|
28
28
|
redirect_to root_path, notice: "Signed in successfully"
|
29
29
|
end
|
@@ -26,8 +26,8 @@ class TwoFactorAuthentication::Challenge::SecurityKeysController < ApplicationCo
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def sign_in_and_redirect_to_root
|
29
|
-
|
30
|
-
cookies.signed.permanent[:session_token] = { value:
|
29
|
+
session_record = @user.sessions.create!
|
30
|
+
cookies.signed.permanent[:session_token] = { value: session_record.id, httponly: true }
|
31
31
|
|
32
32
|
render json: { status: "ok", location: root_url }, status: :created
|
33
33
|
end
|
@@ -24,8 +24,8 @@ class TwoFactorAuthentication::Challenge::TotpsController < ApplicationControlle
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def sign_in_and_redirect_to_root
|
27
|
-
|
28
|
-
cookies.signed.permanent[:session_token] = { value:
|
27
|
+
session_record = @user.sessions.create!
|
28
|
+
cookies.signed.permanent[:session_token] = { value: session_record.id, httponly: true }
|
29
29
|
|
30
30
|
redirect_to root_path, notice: "Signed in successfully"
|
31
31
|
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.16.
|
4
|
+
version: 2.16.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|