Sha256: 32dd51092716601b1499c601deef8f7b7b6c340214304aaf0752f6cf18526da9
Contents?: true
Size: 926 Bytes
Versions: 5
Compression:
Stored size: 926 Bytes
Contents
# frozen_string_literal: true module Masks # @visibility private class KeysController < ApplicationController require_mask type: :session def new @keys = current_actor.keys end def create key = current_actor.keys.build( name: create_params[:name], secret: create_params[:secret]&.presence, scopes: create_params[:scopes] ) key.save if key.valid? flash[:key] = { name: key.name, secret: key.secret } else flash[:error] = key.errors.full_messages.first end redirect_back_or_to keys_path end def delete key = current_actor.keys.find(params[:id]) key.destroy flash[:notice] = "#{key.name} destroyed" if key.destroyed? redirect_back_or_to "/" end private def create_params params.require(:key).permit(:name, :secret, scopes: []) end end end
Version data entries
5 entries across 5 versions & 1 rubygems