Add auth and ruby update

This commit is contained in:
david 2024-09-22 21:57:05 +02:00
parent 5d50194f39
commit fbf6923835
43 changed files with 614 additions and 64 deletions

View file

@ -0,0 +1,45 @@
class CreateRodauth < ActiveRecord::Migration[7.2]
def change
create_table :accounts do |t|
t.integer :status, null: false, default: 1
t.string :email, null: false
t.index :email, unique: true, where: "status IN (1, 2)"
t.string :password_hash
end
# Used by the password reset feature
# create_table :account_password_reset_keys, id: false do |t|
# t.integer :id, primary_key: true
# t.foreign_key :accounts, column: :id
# t.string :key, null: false
# t.datetime :deadline, null: false
# t.datetime :email_last_sent, null: false, default: -> { "CURRENT_TIMESTAMP" }
# end
# Used by the account verification feature
# create_table :account_verification_keys, id: false do |t|
# t.integer :id, primary_key: true
# t.foreign_key :accounts, column: :id
# t.string :key, null: false
# t.datetime :requested_at, null: false, default: -> { "CURRENT_TIMESTAMP" }
# t.datetime :email_last_sent, null: false, default: -> { "CURRENT_TIMESTAMP" }
# end
# Used by the verify login change feature
# create_table :account_login_change_keys, id: false do |t|
# t.integer :id, primary_key: true
# t.foreign_key :accounts, column: :id
# t.string :key, null: false
# t.string :login, null: false
# t.datetime :deadline, null: false
# end
# Used by the remember me feature
create_table :account_remember_keys, id: false do |t|
t.integer :id, primary_key: true
t.foreign_key :accounts, column: :id
t.string :key, null: false
t.datetime :deadline, null: false
end
end
end

15
db/schema.rb generated
View file

@ -10,7 +10,19 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.2].define(version: 2024_09_11_230623) do
ActiveRecord::Schema[7.2].define(version: 2024_09_22_172043) do
create_table "account_remember_keys", force: :cascade do |t|
t.string "key", null: false
t.datetime "deadline", null: false
end
create_table "accounts", force: :cascade do |t|
t.integer "status", default: 1, null: false
t.string "email", null: false
t.string "password_hash"
t.index ["email"], name: "index_accounts_on_email", unique: true, where: "status IN (1, 2)"
end
create_table "action_text_rich_texts", force: :cascade do |t|
t.string "name", null: false
t.text "body"
@ -163,6 +175,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_09_11_230623) do
t.index ["element_id"], name: "index_success_criteria_on_element_id"
end
add_foreign_key "account_remember_keys", "accounts", column: "id"
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "checklist_entries", "checklists"

View file

@ -48,4 +48,6 @@ Link.create!(url: "https://www.a11yproject.com/",
Link.create!(url: "https://www.a11yproject.com/",
text: "The A11Y Project",
description: "The A11Y Project is a community-driven effort to make digital accessibility easier.",
link_category: LinkCategory.find_by(name: "Artikel"))
link_category: LinkCategory.find_by(name: "Artikel"))
Account.find_or_initialize_by(email: "admin@example.com").update!(password: "password")