app/controllers/oa2c/authorizations_controller.rb in oa2c-0.1.0 vs app/controllers/oa2c/authorizations_controller.rb in oa2c-0.1.1

- old
+ new

@@ -1,8 +1,9 @@ module Oa2c class AuthorizationsController < ApplicationController before_filter Oa2c.authentication_method, except: :token + layout Oa2c.layout rescue_from Rack::OAuth2::Server::Authorize::BadRequest do |e| @error = e render :error, status: e.status end @@ -34,11 +35,11 @@ def authorize_endpoint(allow_approval = false) Rack::OAuth2::Server::Authorize.new do |req, res| @client = Client.where(identifier: req.client_id).first || req.bad_request! res.redirect_uri = @redirect_uri = req.verify_redirect_uri!(@client.redirect_uri) - if allow_approval - if params[:approve] + if allow_approval or Oa2c.auto_approve + if params[:approve] or Oa2c.auto_approve case req.response_type when :code authorization_code = send(Oa2c.current_user_method).authorization_codes.create(client_id: @client.id, redirect_uri: res.redirect_uri) res.code = authorization_code.token when :token