Allow non authenticated access to avatars
This commit is contained in:
parent
a4118ca445
commit
897a2de54c
|
@ -1,4 +1,7 @@
|
||||||
class UploadsController < ApplicationController
|
class UploadsController < ApplicationController
|
||||||
|
skip_before_filter :authenticate_user!, :reject_blocked
|
||||||
|
before_filter :authorize_access
|
||||||
|
|
||||||
def show
|
def show
|
||||||
model = params[:model].camelize.constantize.find(params[:id])
|
model = params[:model].camelize.constantize.find(params[:id])
|
||||||
uploader = model.send(params[:mounted_as])
|
uploader = model.send(params[:mounted_as])
|
||||||
|
@ -14,4 +17,10 @@ class UploadsController < ApplicationController
|
||||||
redirect_to uploader.url
|
redirect_to uploader.url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def authorize_access
|
||||||
|
unless params[:mounted_as] == 'avatar'
|
||||||
|
authenticate_user! && reject_blocked
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue