Browse Source

Reset user password and redirect back to org users page

pull/134/head
baarkerlounger 4 years ago committed by Paul Robert Lloyd
parent
commit
b2539a3226
  1. 9
      app/controllers/users_controller.rb

9
app/controllers/users_controller.rb

@ -14,8 +14,9 @@ class UsersController < ApplicationController
end end
def create def create
@user = User.create!(user_params.merge(org_params)) @user = User.create!(user_params.merge(org_params).merge(password_params))
redirect_to @user @user.send_reset_password_instructions
redirect_to users_organisation_path(current_user.organisation)
end end
def edit_password def edit_password
@ -24,6 +25,10 @@ class UsersController < ApplicationController
private private
def password_params
{ password: SecureRandom.hex(8) }
end
def org_params def org_params
{ organisation: current_user.organisation } { organisation: current_user.organisation }
end end

Loading…
Cancel
Save