Allow newly-registered users to lookup their own profiles

When a user creates an account and the 'require_auth_for_profile_requests' config flag is set, and a client that performed the registration wants to lookup the newly-created profile, the request will be denied because the user doesn't share a room with themselves yet.
This commit is contained in:
Brendan Abolivier 2019-07-08 17:31:00 +01:00
parent 4b1f7febc7
commit 7556851665
No known key found for this signature in database
GPG Key ID: 1E015C145F1916CD

View File

@ -303,6 +303,10 @@ class BaseProfileHandler(BaseHandler):
if not self.hs.config.require_auth_for_profile_requests or not requester: if not self.hs.config.require_auth_for_profile_requests or not requester:
return return
# Always allow the user to query their own profile.
if target_user.to_string() == requester.to_string():
return
try: try:
requester_rooms = yield self.store.get_rooms_for_user(requester.to_string()) requester_rooms = yield self.store.get_rooms_for_user(requester.to_string())
target_user_rooms = yield self.store.get_rooms_for_user( target_user_rooms = yield self.store.get_rooms_for_user(