Cleanup & simplify sign in
This commit is contained in:
@@ -129,8 +129,9 @@ module Authentication
|
||||
end
|
||||
|
||||
def serve_development_magic_link(magic_link)
|
||||
if Rails.env.development?
|
||||
flash[:magic_link_code] = magic_link&.code
|
||||
if Rails.env.development? && magic_link.present?
|
||||
flash[:magic_link_code] = magic_link.code
|
||||
response.set_header("X-Magic-Link-Code", magic_link.code)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,7 +24,6 @@ class SessionsController < ApplicationController
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_session_magic_link magic_link }
|
||||
format.json do
|
||||
response.set_header("X-Magic-Link-Code", magic_link&.code) if Rails.env.development? && magic_link
|
||||
head :created
|
||||
end
|
||||
end
|
||||
@@ -42,6 +41,7 @@ class SessionsController < ApplicationController
|
||||
|
||||
def rate_limit_exceeded
|
||||
rate_limit_exceeded_message = "Try again later."
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to new_session_path, alert: rate_limit_exceeded_message }
|
||||
format.json { render json: { message: rate_limit_exceeded_message }, status: :too_many_requests }
|
||||
|
||||
Reference in New Issue
Block a user