Method: AuthenticationsController#destroy

Defined in:
lib/generators/frame/omniauth/templates/app/controllers/authentications_controller.rb

#destroyObject



34
35
36
37
38
39
40
41
42
43
# File 'lib/generators/frame/omniauth/templates/app/controllers/authentications_controller.rb', line 34

def destroy
  if ( current_user.authentications.count == 1 && current_user.encrypted_password.empty? )
    flash[:error] = "You must first set a password on the <a href=\"#{edit_user_registration_path}\">preferences page</a>".html_safe
  else
    @authentication = current_user.authentications.find(params[:id])
    @authentication.destroy
    flash[:success] = "Successfully destroyed authentication."
  end
  redirect_to authentications_url
end