standard_id 0.26.3 → 0.26.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a44aeb31a30319f06f305078bc0d9f0f5c20eff095680f3414085a7fb031c39c
4
- data.tar.gz: 05bb225c7724ece28d0702345fe8f0560bef3e69d972a4b5f82ee3f97a304048
3
+ metadata.gz: 80484283cdfb54ecc2ead53d1498b5cd9ee88813e755b972db2e2d15561362f7
4
+ data.tar.gz: 9f9aaea4b18b29a61c3d3e70d7be8f1c2016455b3866181b9bea0cd272617405
5
5
  SHA512:
6
- metadata.gz: 4d796392613832ea4987009991eb1c191936a492cfe60e69964ee28416c9e6c5715263499bf12045563bf9d861996f07fc6eca0def955e776dbf25cbb4f2b833
7
- data.tar.gz: e12e0634851c73da51edff7433392bf44ce721fbc078dc993cee9f6035bec336ca60b38c2d0897e9a0478075d32ff9984c0ecfb1063882a9cfcf814501a2e75b
6
+ metadata.gz: 203398f53eacaf60b272dbaf84794c71d2a975fbd1f49669d37dc3375de6fa7d24f00b36f352a9bb09909e82e1947f4513082b397b61a664e22f0180aa34f665
7
+ data.tar.gz: 737d854a5784cf508954f343482e0476e2f5ad7a40322a26d7e0360c6910af6333a954bab7e9f490fb66ffc77ee15946dff62e2afd4a5d67387c9aca60e04cf4
@@ -197,7 +197,9 @@ module StandardId
197
197
  # When raised without arguments, StandardError#message returns the class name
198
198
  message = "Sign-in was denied" if message.blank? || message == error.class.name
199
199
  login_path = begin
200
- StandardId::WebEngine.routes.url_helpers.login_path
200
+ # Engine `_path` helpers are mount-relative and redirect_to won't prepend
201
+ # the mount's SCRIPT_NAME (no-op at root), so a non-root mount would 404.
202
+ "#{request.script_name}#{StandardId::WebEngine.routes.url_helpers.login_path}"
201
203
  rescue NameError, NoMethodError, ActionController::UrlGenerationError
202
204
  StandardId.config.login_url || "/"
203
205
  end
@@ -16,7 +16,7 @@ module StandardId
16
16
  @account = current_account
17
17
 
18
18
  if @account.update(account_params)
19
- redirect_to account_path, notice: "Account updated successfully"
19
+ redirect_to engine_path(account_path), notice: "Account updated successfully"
20
20
  else
21
21
  flash.now[:alert] = @account.errors.full_messages.join(", ")
22
22
  render :edit, status: :unprocessable_content
@@ -36,6 +36,21 @@ module StandardId
36
36
  redirect_to_login
37
37
  end
38
38
 
39
+ # Prefix an engine-relative path with the current mount point's SCRIPT_NAME.
40
+ #
41
+ # Isolated-engine `_path` helpers return paths relative to the engine mount
42
+ # (e.g. "/login_verify"), and `redirect_to` / `redirect_with_inertia` —
43
+ # unlike view URL generation (form_with / link_to / url_for) — do NOT
44
+ # prepend the mount's SCRIPT_NAME. So a bare `redirect_to login_verify_path`
45
+ # 404s when the engine is mounted at a non-root path (e.g. "/auth" yields
46
+ # "/login_verify" instead of "/auth/login_verify"). SCRIPT_NAME is "" for a
47
+ # root mount, so this is a no-op there. Apply ONLY to engine-relative paths
48
+ # — host destinations (after_authentication_url, safe_post_signin_default)
49
+ # are already absolute and must not be prefixed.
50
+ def engine_path(path)
51
+ "#{request.script_name}#{path}"
52
+ end
53
+
39
54
  # Read a top-level query/form param expected to be a scalar String, returning
40
55
  # nil for absent/blank values OR if Rails parsed it as an Array/Hash (e.g. from
41
56
  # `?redirect_uri[]=a&redirect_uri[]=b`). Without this guard, `redirect_to` is
@@ -108,7 +108,7 @@ module StandardId
108
108
  redirect_uri = string_param(:redirect_uri)
109
109
  session[:return_to_after_authenticating] = redirect_uri if redirect_uri
110
110
 
111
- redirect_to login_verify_path, status: :see_other
111
+ redirect_to engine_path(login_verify_path), status: :see_other
112
112
  end
113
113
 
114
114
  def redirect_if_authenticated
@@ -94,7 +94,7 @@ module StandardId
94
94
  signed_payload = session[:standard_id_otp_payload]
95
95
 
96
96
  if signed_payload.blank?
97
- redirect_to login_path, alert: "Please start the login process"
97
+ redirect_to engine_path(login_path), alert: "Please start the login process"
98
98
  return
99
99
  end
100
100
 
@@ -102,7 +102,7 @@ module StandardId
102
102
  @otp_data = Rails.application.message_verifier(:otp).verify(signed_payload).symbolize_keys
103
103
  rescue ActiveSupport::MessageVerifier::InvalidSignature
104
104
  session.delete(:standard_id_otp_payload)
105
- redirect_to login_path, alert: "Your verification session has expired. Please try again."
105
+ redirect_to engine_path(login_path), alert: "Your verification session has expired. Please try again."
106
106
  end
107
107
  end
108
108
 
@@ -20,7 +20,7 @@ module StandardId
20
20
 
21
21
  if form.submit
22
22
  flash[:notice] = "Your password has been successfully reset. Please sign in with your new password."
23
- redirect_to login_path, status: :see_other
23
+ redirect_to engine_path(login_path), status: :see_other
24
24
  else
25
25
  flash.now[:alert] = form.errors.full_messages.to_sentence
26
26
  render :show, status: :unprocessable_content
@@ -41,7 +41,7 @@ module StandardId
41
41
  return if @password_credential.present?
42
42
 
43
43
  flash[:alert] = "Invalid or expired password reset link"
44
- redirect_to login_path, status: :see_other
44
+ redirect_to engine_path(login_path), status: :see_other
45
45
  end
46
46
  end
47
47
  end
@@ -21,7 +21,7 @@ module StandardId
21
21
 
22
22
  if form.submit
23
23
  flash[:notice] = "If an account with that email exists, we've sent password reset instructions."
24
- redirect_to login_path, status: :see_other
24
+ redirect_to engine_path(login_path), status: :see_other
25
25
  else
26
26
  flash.now[:alert] = form.errors[:email].first || "Please enter your email address"
27
27
  render :show, status: :unprocessable_content
@@ -19,10 +19,10 @@ module StandardId
19
19
  else
20
20
  # Revoke other session
21
21
  session.revoke!
22
- redirect_to sessions_path, notice: "Session revoked successfully"
22
+ redirect_to engine_path(sessions_path), notice: "Session revoked successfully"
23
23
  end
24
24
  rescue ActiveRecord::RecordNotFound
25
- redirect_to sessions_path, alert: "Session not found"
25
+ redirect_to engine_path(sessions_path), alert: "Session not found"
26
26
  end
27
27
  end
28
28
  end
@@ -1,3 +1,3 @@
1
1
  module StandardId
2
- VERSION = "0.26.3"
2
+ VERSION = "0.26.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.3
4
+ version: 0.26.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaryl Sim