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

Loading…
Cancel
Save