mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
add program return button (#314)
This commit is contained in:
@@ -38,7 +38,7 @@ module Api
|
||||
end
|
||||
|
||||
def magic_link_params
|
||||
params.permit(:continue_param)
|
||||
params.permit(:continue_param, return_data: {})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -156,6 +156,7 @@ class SessionsController < ApplicationController
|
||||
if valid_token
|
||||
valid_token.mark_used!
|
||||
session[:user_id] = valid_token.user_id
|
||||
session[:return_data] = valid_token.return_data || {}
|
||||
|
||||
if valid_token.continue_param.present?
|
||||
redirect_to valid_token.continue_param, notice: "Successfully signed in!"
|
||||
|
||||
@@ -14,6 +14,12 @@
|
||||
<button>Set up another editor</button>
|
||||
<% end %>
|
||||
|
||||
<%= link_to root_path do %>
|
||||
<button>Done</button>
|
||||
<% if (url = session.dig(:return_data, "url")) %>
|
||||
<%= link_to url do %>
|
||||
<button><%= session.dig(:return_data, "button_text") || "Done" %></button>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to root_path do %>
|
||||
<button>Done</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddReturnDataToSignInTokens < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
add_column :sign_in_tokens, :return_data, :jsonb
|
||||
end
|
||||
end
|
||||
3
db/schema.rb
generated
3
db/schema.rb
generated
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_06_11_071124) do
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_06_13_163710) do
|
||||
create_schema "pganalyze"
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
@@ -464,6 +464,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_11_071124) do
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "continue_param"
|
||||
t.jsonb "return_data"
|
||||
t.index ["token"], name: "index_sign_in_tokens_on_token"
|
||||
t.index ["user_id"], name: "index_sign_in_tokens_on_user_id"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user