Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ RAILS_ENV=development
APP_HOST=localhost:3000
RAILS_SERVE_STATIC_FILES=true
ORGANIZATION_NAME=A Window Between Worlds
REPLY_TO_EMAIL=umberto.user@example.com
REPLY_TO_EMAIL=umberto.user@example.com
8 changes: 6 additions & 2 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class UsersController < ApplicationController
before_action :set_user, only: [ :show, :edit, :update, :destroy, :generate_facilitator ]
before_action :set_user, only: [ :show, :edit, :update, :destroy, :generate_facilitator, :send_reset_password_instructions ]

def index
return redirect_to authenticated_root_path unless current_user.super_user?
Expand Down Expand Up @@ -97,6 +97,10 @@ def generate_facilitator
end
end

def send_reset_password_instructions
@user.send_reset_password_instructions
redirect_to users_path, notice: "Reset password instructions sent to #{@user.email}."
end
private

def set_user
Expand Down Expand Up @@ -138,4 +142,4 @@ def user_params
project_users_attributes: [ :id, :project_id, :position, :title, :inactive, :_destroy ]
)
end
end
end
4 changes: 4 additions & 0 deletions app/views/users/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
<div class="flex items-center justify-between mb-4">
<h1 class="text-2xl font-semibold text-gray-900">Edit <%= @user.class.model_name.human %></h1>
<div class="flex space-x-2">
<%= button_to "Reset password",
send_reset_password_instructions_user_path(@user),
method: :post,
class: "btn btn-secondary-outline" %>
<% if current_user == @user %>
<%= link_to "Change password",
change_password_path,
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
resources :users, only: [ :new, :index, :show, :edit, :update, :create, :destroy ] do
member do
get :generate_facilitator
post :send_reset_password_instructions
end
end
resources :user_forms
Expand Down
24 changes: 14 additions & 10 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[8.1].define(version: 2026_01_19_143438) do
ActiveRecord::Schema[8.1].define(version: 2026_01_20_212705) do
create_table "action_text_mentions", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
t.bigint "action_text_rich_text_id", null: false
t.datetime "created_at", null: false
Expand All @@ -26,6 +26,7 @@
t.text "body", size: :long
t.datetime "created_at", null: false
t.string "name", null: false
t.text "plain_text_body"
t.bigint "record_id", null: false
t.string "record_type", null: false
t.datetime "updated_at", null: false
Expand Down Expand Up @@ -128,17 +129,17 @@
t.string "country"
t.string "device_type"
t.string "ip"
t.text "landing_page"
t.text "landing_page", size: :medium
t.float "latitude"
t.float "longitude"
t.string "os"
t.string "os_version"
t.string "platform"
t.text "referrer"
t.text "referrer", size: :medium
t.string "referring_domain"
t.string "region"
t.datetime "started_at"
t.text "user_agent"
t.text "user_agent", size: :medium
t.bigint "user_id"
t.string "utm_campaign"
t.string "utm_content"
Expand Down Expand Up @@ -231,6 +232,7 @@
t.integer "legacy_id"
t.datetime "updated_at", precision: nil, null: false
t.index ["categorizable_type", "categorizable_id"], name: "idx_on_categorizable_type_categorizable_id_ccce65d80c"
t.index ["category_id", "categorizable_type", "categorizable_id"], name: "index_categorizable_items_uniqueness", unique: true
t.index ["category_id"], name: "index_categorizable_items_on_category_id"
end

Expand Down Expand Up @@ -329,7 +331,7 @@
t.string "last_name", null: false
t.string "linked_in_url"
t.date "member_since"
t.text "notes"
t.text "notes", size: :medium
t.boolean "profile_is_searchable", default: true, null: false
t.boolean "profile_show_affiliations", default: true, null: false
t.boolean "profile_show_bio", default: true, null: false
Expand Down Expand Up @@ -482,9 +484,9 @@
create_table "notifications", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
t.datetime "created_at", precision: nil, null: false
t.datetime "delivered_at"
t.text "email_body_html"
t.text "email_body_text"
t.text "email_subject"
t.text "email_body_html", size: :medium
t.text "email_body_text", size: :medium
t.text "email_subject", size: :medium
t.string "kind", null: false
t.integer "noticeable_id"
t.string "noticeable_type"
Expand Down Expand Up @@ -678,6 +680,7 @@
t.integer "sectorable_id"
t.string "sectorable_type"
t.datetime "updated_at", precision: nil, null: false
t.index ["sector_id", "sectorable_type", "sectorable_id"], name: "index_sectorable_items_uniqueness", unique: true
t.index ["sector_id"], name: "index_sectorable_items_on_sector_id"
t.index ["sectorable_type", "sectorable_id"], name: "index_sectorable_items_on_sectorable_type_and_sectorable_id"
end
Expand Down Expand Up @@ -739,7 +742,7 @@
end

create_table "tutorials", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
t.text "body"
t.text "body", size: :medium
t.datetime "created_at", null: false
t.boolean "featured", default: false, null: false
t.integer "position", default: 10, null: false
Expand Down Expand Up @@ -1069,6 +1072,7 @@
end

add_foreign_key "action_text_mentions", "action_text_rich_texts"
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 "age_ranges", "windows_types"
add_foreign_key "banners", "users", column: "created_by_id"
Expand Down Expand Up @@ -1149,4 +1153,4 @@
add_foreign_key "workshops", "users"
add_foreign_key "workshops", "windows_types"
add_foreign_key "workshops", "workshop_ideas"
end
end
Loading