aboutsummaryrefslogtreecommitdiff
path: root/src/actions/password_reset_requests/create.cr
blob: 8f3c513017e95fa23f3f9ac2e6100baab4b2dfd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class PasswordResetRequests::Create < BrowserAction
  include Auth::RedirectSignedInUsers

  post "/password_reset_requests" do
    RequestPasswordReset.run(params) do |operation, user|
      if user
        PasswordResetRequestEmail.new(user).deliver
        flash.success = "You should receive an email on how to reset your password shortly"
        redirect SignIns::New
      else
        html NewPage, operation: operation
      end
    end
  end
end