Class: Stormpath::Rails::ForgotPassword::CreateController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/stormpath/rails/forgot_password/create_controller.rb

Instance Method Summary collapse

Instance Method Details

#callObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/stormpath/rails/forgot_password/create_controller.rb', line 5

def call
  begin
    if organization_resolution?
      OrganizationForm.new(params[:organization_name_key]).save!
    else
      SendPasswordResetEmail.new(params[:email], current_organization).call
    end
    respond_with_success
  rescue SendPasswordResetEmail::UnexistingEmailError
    respond_with_success
  rescue SendPasswordResetEmail::NoEmailError, Stormpath::Rails::OrganizationForm::FormError => error
    respond_with_error(error)
  end
end