Skip to content

Commit

Permalink
Align reverification names with other sdks (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef authored Nov 22, 2024
1 parent 1aa4bd1 commit 7b3ba0c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/clerk/authenticatable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def clerk_user_needs_reverification?(params=StepUp::PRESETS[:strict])
end

def clerk_render_reverification(missing_config=nil)
payload = request.env['clerk'].reverification_mismatch_payload(missing_config)
payload = request.env['clerk'].reverification_error_payload(missing_config)

render status: 403, json: payload
end
Expand Down
2 changes: 1 addition & 1 deletion lib/clerk/constants.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Clerk
module StepUp
PRESETS = {
very_strict: { after_minutes: 10, level: :multi_factor },
strict_mfa: { after_minutes: 10, level: :multi_factor },
strict: { after_minutes: 10, level: :second_factor },
moderate: { after_minutes: 60, level: :second_factor },
lax: { after_minutes: 1440, level: :second_factor }
Expand Down
6 changes: 3 additions & 3 deletions lib/clerk/rack_middleware_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ def is_user_reverified?(params)
end
end

def reverification_mismatch_payload(missing_config)
def reverification_error_payload(missing_config)
{
clerk_error: {
type: "forbidden",
reason: "reverification-mismatch",
reason: "reverification-error",
metadata: { reverification: missing_config, }
}
}
Expand All @@ -101,7 +101,7 @@ def reverification_response(missing_config=nil)
[
403,
{ "Content-Type" => "application/json" },
[reverification_mismatch_payload(missing_config).to_json],
[reverification_error_payload(missing_config).to_json],
]
end

Expand Down

0 comments on commit 7b3ba0c

Please sign in to comment.