current_user can be nil

This commit is contained in:
Connor Turland 2015-11-04 00:14:14 -05:00
parent f8814c060f
commit 87389a88ed

View file

@ -61,6 +61,6 @@ private
unsafe_uri = request.env["REQUEST_URI"] unsafe_uri = request.env["REQUEST_URI"]
valid_url = /^https?:\/\/([\w\.-]+)(:\d{1,5})?\/?$/ valid_url = /^https?:\/\/([\w\.-]+)(:\d{1,5})?\/?$/
safe_uri = (unsafe_uri.match(valid_url)) ? unsafe_uri : "http://metamaps.cc/" safe_uri = (unsafe_uri.match(valid_url)) ? unsafe_uri : "http://metamaps.cc/"
@invite_link = "#{safe_uri}join?code=#{current_user.code}" @invite_link = "#{safe_uri}join" + (current_user ? "?code=#{current_user.code}" : "")
end end
end end