diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 7b53e2a9e..1ee7a70df 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,5 @@ class UsersController < ApplicationController - before_action :set_user, only: [ :show, :edit, :update, :destroy, :generate_facilitator, :toggle_lock_status ] + before_action :set_user, only: [ :show, :edit, :update, :destroy, :generate_facilitator, :toggle_lock_status, :send_reset_password_instructions ] def index return redirect_to root_path unless current_user.super_user? @@ -97,6 +97,11 @@ 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 + def toggle_lock_status return redirect_to users_path, alert: "You don't have permission to perform this action." unless current_user.super_user? diff --git a/app/views/events/_card.html.erb b/app/views/events/_card.html.erb index 4b6e82c8c..66a4af58b 100644 --- a/app/views/events/_card.html.erb +++ b/app/views/events/_card.html.erb @@ -70,7 +70,7 @@ <% if event.event_registrations.exists?(registrant_id: current_user.id) %>
- + Add to your calendar: <%= event.calendar_links %>
<% end %> diff --git a/app/views/events/show.html.erb b/app/views/events/show.html.erb index 37c658144..d175ec44d 100644 --- a/app/views/events/show.html.erb +++ b/app/views/events/show.html.erb @@ -74,6 +74,7 @@ <% if registered %>
+ Add to your calendar: <%= @event.calendar_links %>
<% end %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 4bc553713..6d646477e 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -7,6 +7,10 @@ <%= render "lock_status_indicator", user: @user %>
+ <%= 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, diff --git a/config/routes.rb b/config/routes.rb index 8995d968b..5fe95b528 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -92,6 +92,7 @@ resources :users, only: [ :new, :index, :show, :edit, :update, :create, :destroy ] do member do get :generate_facilitator + post :send_reset_password_instructions post :toggle_lock_status end end