Add verified_at timestamp to use for spam prevention
User are marked as verified after a join code is redeemed. The user is redirected to Users::VerificationsController, either: - after submitting a valid magic link code, - or immediately after redeeming the join code (if they're already authenticated with the correct identity) Account owners are automatically verified when the account is created (because they have already provided a magic link code at that point). This sets up for later commits that will backfill existing users and require verification before sending notification emails. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
class AddVerifiedAtToUsers < ActiveRecord::Migration[8.2]
|
||||
def change
|
||||
add_column :users, :verified_at, :datetime
|
||||
end
|
||||
end
|
||||
Generated
+2
-1
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.2].define(version: 2025_12_01_100607) do
|
||||
ActiveRecord::Schema[8.2].define(version: 2025_12_05_010536) do
|
||||
create_table "accesses", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.datetime "accessed_at"
|
||||
t.uuid "account_id", null: false
|
||||
@@ -726,6 +726,7 @@ ActiveRecord::Schema[8.2].define(version: 2025_12_01_100607) do
|
||||
t.string "name", null: false
|
||||
t.string "role", default: "member", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "verified_at"
|
||||
t.index ["account_id", "identity_id"], name: "index_users_on_account_id_and_identity_id", unique: true
|
||||
t.index ["account_id", "role"], name: "index_users_on_account_id_and_role"
|
||||
t.index ["identity_id"], name: "index_users_on_identity_id"
|
||||
|
||||
+2
-1
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.2].define(version: 2025_12_01_100607) do
|
||||
ActiveRecord::Schema[8.2].define(version: 2025_12_05_010536) do
|
||||
create_table "accesses", id: :uuid, force: :cascade do |t|
|
||||
t.datetime "accessed_at"
|
||||
t.uuid "account_id", null: false
|
||||
@@ -499,6 +499,7 @@ ActiveRecord::Schema[8.2].define(version: 2025_12_01_100607) do
|
||||
t.string "name", limit: 255, null: false
|
||||
t.string "role", limit: 255, default: "member", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "verified_at"
|
||||
t.index ["account_id", "identity_id"], name: "index_users_on_account_id_and_identity_id", unique: true
|
||||
t.index ["account_id", "role"], name: "index_users_on_account_id_and_role"
|
||||
t.index ["identity_id"], name: "index_users_on_identity_id"
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ else
|
||||
if user = identity.users.find_by(account: Current.account)
|
||||
user
|
||||
else
|
||||
User.create!(name: full_name, identity: identity, account: Current.account)
|
||||
User.create!(name: full_name, identity: identity, account: Current.account, verified_at: Time.current)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user