Sha256: 99c8b9affae8e2bb6cecf30c5ac862d2bb7238d90214bcbda65719762afe8e0b

Contents?: true

Size: 656 Bytes

Versions: 23

Compression:

Stored size: 656 Bytes

Contents

class UserCredentialsController < ApplicationController

  def upsert
    credentials = current_user.credentials.where(service: params[:service]).first_or_initialize
    credentials.login = params[:login]
    credentials.password = params[:password]

    if credentials.save
      head :ok
    else
      render json: credentials.errors, status: :unprocessable_entity
    end
  end

  def destroy
    credentials = current_user.credentials.find_by_id(params[:id])
    if credentials && credentials.delete
      redirect_to :back, notice: "Houston has deleted your credentials for #{credentials.service}"
    else
      redirect_to :back
    end
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
houston-core-0.8.4 app/controllers/user_credentials_controller.rb
houston-core-0.8.3 app/controllers/user_credentials_controller.rb
houston-core-0.8.2 app/controllers/user_credentials_controller.rb
houston-core-0.8.1 app/controllers/user_credentials_controller.rb
houston-core-0.8.0 app/controllers/user_credentials_controller.rb
houston-core-0.8.0.pre2 app/controllers/user_credentials_controller.rb
houston-core-0.8.0.pre app/controllers/user_credentials_controller.rb
houston-core-0.7.0 app/controllers/user_credentials_controller.rb
houston-core-0.7.0.beta4 app/controllers/user_credentials_controller.rb
houston-core-0.7.0.beta3 app/controllers/user_credentials_controller.rb
houston-core-0.7.0.beta2 app/controllers/user_credentials_controller.rb
houston-core-0.7.0.beta app/controllers/user_credentials_controller.rb
houston-core-0.6.3 app/controllers/user_credentials_controller.rb
houston-core-0.6.2 app/controllers/user_credentials_controller.rb
houston-core-0.6.1 app/controllers/user_credentials_controller.rb
houston-core-0.6.0 app/controllers/user_credentials_controller.rb
houston-core-0.5.6 app/controllers/user_credentials_controller.rb
houston-core-0.5.5 app/controllers/user_credentials_controller.rb
houston-core-0.5.4 app/controllers/user_credentials_controller.rb
houston-core-0.5.3 app/controllers/user_credentials_controller.rb