1 class ApiController < ApplicationController
2 skip_before_action :verify_authenticity_token
6 def authorize(realm = "Web Password", errormessage = "Couldn't authenticate you")
7 # make the current_user object from any auth sources we have
10 # handle authenticate pass/fail
12 # no auth, the user does not exist or the password was wrong
13 response.headers["WWW-Authenticate"] = "Basic realm=\"#{realm}\""
14 render :plain => errormessage, :status => :unauthorized
19 def deny_access(_exception)
22 report_error t("oauth.permissions.missing"), :forbidden
26 realm = "Web Password"
27 errormessage = "Couldn't authenticate you"
28 response.headers["WWW-Authenticate"] = "Basic realm=\"#{realm}\""
29 render :plain => errormessage, :status => :unauthorized