frontend/app/controllers/publickeys_controller.rb in meroku-2.0.8 vs frontend/app/controllers/publickeys_controller.rb in meroku-2.0.9
- old
+ new
@@ -1,75 +1,74 @@
class PublickeysController < ApplicationController
before_action :set_publickey, only: [:show, :edit, :update, :destroy]
skip_before_action :verify_authenticity_token, only: [:create]
- # GET /publickeys
- # GET /publickeys.json
- def index
- @publickeys = Publickey.all
- end
+ ## GET /publickeys
+ ## GET /publickeys.json
+ #def index
+ # @publickeys = Publickey.all
+ #end
+ #
+ ## GET /publickeys/1
+ ## GET /publickeys/1.json
+ #def show
+ #end
+ #
+ ## GET /publickeys/new
+ #def new
+ # @publickey = Publickey.new
+ #end
+ #
+ ## GET /publickeys/1/edit
+ #def edit
+ #end
- # GET /publickeys/1
- # GET /publickeys/1.json
- def show
- end
-
- # GET /publickeys/new
- def new
- @publickey = Publickey.new
- end
-
- # GET /publickeys/1/edit
- def edit
- end
-
# POST /publickeys
# POST /publickeys.json
def create
@publickey = Publickey.new(publickey_params)
- @publickey.user = User.find_by_token(params[:token])
+ @publickey.user = User.find_by_apisecret(params[:apisecret])
if !@publickey.user
(render :jsonapi_errors => [{
- title: 'Invalid Authorization Token',
- detail: 'Invalid token. Try logging in again.'
+ title: 'Authentiction failed',
+ detail: 'Invalid Authentication failed. Try logging in again.'
}]) and return
end
respond_to do |format|
if @publickey.save
format.html { redirect_to @publickey, notice: 'Publickey was successfully created.' }
- #format.json { render :show, status: :created, location: @publickey }
format.json { render jsonapi: @publickey }
else
format.html { render :new }
format.json { render jsonapi_errors: @publickey.errors }
end
end
end
- # PATCH/PUT /publickeys/1
- # PATCH/PUT /publickeys/1.json
- def update
- respond_to do |format|
- if @publickey.update(publickey_params)
- format.html { redirect_to @publickey, notice: 'Publickey was successfully updated.' }
- format.json { render :show, status: :ok, location: @publickey }
- else
- format.html { render :edit }
- format.json { render json: @publickey.errors, status: :unprocessable_entity }
- end
- end
- end
-
- # DELETE /publickeys/1
- # DELETE /publickeys/1.json
- def destroy
- @publickey.destroy
- respond_to do |format|
- format.html { redirect_to publickeys_url, notice: 'Publickey was successfully destroyed.' }
- format.json { head :no_content }
- end
- end
+ ## PATCH/PUT /publickeys/1
+ ## PATCH/PUT /publickeys/1.json
+ #def update
+ # respond_to do |format|
+ # if @publickey.update(publickey_params)
+ # format.html { redirect_to @publickey, notice: 'Publickey was successfully updated.' }
+ # format.json { render :show, status: :ok, location: @publickey }
+ # else
+ # format.html { render :edit }
+ # format.json { render json: @publickey.errors, status: :unprocessable_entity }
+ # end
+ # end
+ #end
+ #
+ ## DELETE /publickeys/1
+ ## DELETE /publickeys/1.json
+ #def destroy
+ # @publickey.destroy
+ # respond_to do |format|
+ # format.html { redirect_to publickeys_url, notice: 'Publickey was successfully destroyed.' }
+ # format.json { head :no_content }
+ # end
+ #end
private
# Use callbacks to share common setup or constraints between actions.
def set_publickey
@publickey = Publickey.find(params[:id])