Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
55bc8d53
Commit
55bc8d53
authored
5 years ago
by
Andrew Morgan
Browse files
Options
Downloads
Patches
Plain Diff
raise exception after multiple failures
parent
1fe3cc2c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/handlers/register.py
+10
-3
10 additions, 3 deletions
synapse/handlers/register.py
with
10 additions
and
3 deletions
synapse/handlers/register.py
+
10
−
3
View file @
55bc8d53
...
@@ -217,8 +217,13 @@ class RegistrationHandler(BaseHandler):
...
@@ -217,8 +217,13 @@ class RegistrationHandler(BaseHandler):
else
:
else
:
# autogen a sequential user ID
# autogen a sequential user ID
# Fail after being unable to find a suitable ID a few times
fail_count
=
0
for
x
in
range
(
10
):
user
=
None
while
not
user
:
# Fail after being unable to find a suitable ID a few times
if
fail_count
>
10
:
raise
SynapseError
(
500
,
"
Unable to find a suitable guest user ID
"
)
localpart
=
yield
self
.
_generate_user_id
()
localpart
=
yield
self
.
_generate_user_id
()
user
=
UserID
(
localpart
,
self
.
hs
.
hostname
)
user
=
UserID
(
localpart
,
self
.
hs
.
hostname
)
user_id
=
user
.
to_string
()
user_id
=
user
.
to_string
()
...
@@ -238,7 +243,9 @@ class RegistrationHandler(BaseHandler):
...
@@ -238,7 +243,9 @@ class RegistrationHandler(BaseHandler):
break
break
except
SynapseError
:
except
SynapseError
:
# if user id is taken, just generate another
# if user id is taken, just generate another
pass
user
=
None
user_id
=
None
fail_count
+=
1
if
not
self
.
hs
.
config
.
user_consent_at_registration
:
if
not
self
.
hs
.
config
.
user_consent_at_registration
:
yield
self
.
_auto_join_rooms
(
user_id
)
yield
self
.
_auto_join_rooms
(
user_id
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment