Files
danbooru/app/controllers/api_keys_controller.rb
r888888888 6772566665 fixes #2166
2014-07-23 15:15:47 -07:00

18 lines
385 B
Ruby

class ApiKeysController < ApplicationController
before_filter :gold_only
def new
@api_key = ApiKey.new(:user_id => CurrentUser.user.id)
end
def create
@api_key = ApiKey.generate!(CurrentUser.user)
if @api_key.errors.empty?
redirect_to user_path(CurrentUser.user), :notice => "API key generated"
else
render :action => "new"
end
end
end