2018-03-08 07:56:54 -05:00
|
|
|
module Constraints
|
|
|
|
class UserUrlConstrainer
|
|
|
|
def matches?(request)
|
|
|
|
full_path = request.params[:username]
|
2017-05-24 16:59:26 -04:00
|
|
|
|
2018-03-08 07:56:54 -05:00
|
|
|
return false unless NamespacePathValidator.valid_path?(full_path)
|
2017-05-24 16:59:26 -04:00
|
|
|
|
2018-03-08 07:56:54 -05:00
|
|
|
User.find_by_full_path(full_path, follow_redirects: request.get?).present?
|
|
|
|
end
|
2016-10-06 08:14:24 -04:00
|
|
|
end
|
|
|
|
end
|