Skip to content

Self-Registration config #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed and tidied up code for disabling registrations
  • Loading branch information
swarley7 committed Jul 24, 2017
commit 527cf32bd2ba1180cdb8884902d8a71a1138a546
27 changes: 5 additions & 22 deletions api/apiserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,7 @@ def delete( self ):
})

def make_app():
if settings['self_registration'] == "yes":
return tornado.web.Application([
(r"/api/register", RegisterHandler),
app_routes = [
(r"/api/login", LoginHandler),
(r"/api/collected_pages", GetCollectedPagesHandler),
(r"/api/delete_injection", DeleteInjectionHandler),
Expand All @@ -674,25 +672,10 @@ def make_app():
(r"/uploads/(.*)", tornado.web.StaticFileHandler, {"path": "uploads/"}),
(r"/api/record_injection", InjectionRequestHandler),
(r"/(.*)", HomepageHandler),
], cookie_secret=settings["cookie_secret"])
else: # Self registration is disabled; don't add the route to the application
return tornado.web.Application([
(r"/api/login", LoginHandler),
(r"/api/collected_pages", GetCollectedPagesHandler),
(r"/api/delete_injection", DeleteInjectionHandler),
(r"/api/delete_collected_page", DeleteCollectedPageHandler),
(r"/api/user", UserInformationHandler),
(r"/api/payloadfires", GetXSSPayloadFiresHandler),
(r"/api/contactus", ContactUsHandler),
(r"/api/resend_injection_email", ResendInjectionEmailHandler),
(r"/api/logout", LogoutHandler),
(r"/js_callback", CallbackHandler),
(r"/page_callback", CollectPageHandler),
(r"/health", HealthHandler),
(r"/uploads/(.*)", tornado.web.StaticFileHandler, {"path": "uploads/"}),
(r"/api/record_injection", InjectionRequestHandler),
(r"/(.*)", HomepageHandler),
], cookie_secret=settings["cookie_secret"])
]
if settings['self_registration']:
app_routes.append((r"/api/register", RegisterHandler))
return tornado.web.Application(app_routes, cookie_secret=settings["cookie_secret"])

if __name__ == "__main__":
args = sys.argv
Expand Down
17 changes: 5 additions & 12 deletions gui/guiserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,16 @@ def get(self):
self.write( loader.load( "contact.htm" ).generate() )

def make_app():
if settings['self_registration'] == "yes":
return tornado.web.Application([
app_routes = [
(r"/", HomepageHandler),
(r"/app", XSSHunterApplicationHandler),
(r"/features", FeaturesHandler),
(r"/signup", SignUpHandler),
(r"/contact", ContactHandler),
(r"/static/(.*)", tornado.web.StaticFileHandler, {"path": "static/"}),
])
else:
return tornado.web.Application([
(r"/", HomepageHandler),
(r"/app", XSSHunterApplicationHandler),
(r"/features", FeaturesHandler),
(r"/contact", ContactHandler),
(r"/static/(.*)", tornado.web.StaticFileHandler, {"path": "static/"}),
])
]
if settings['self_registration']:
app_routes.append((r"/signup", SignUpHandler))
return tornado.web.Application(app_routes)

if __name__ == "__main__":
DOMAIN = settings["domain"]
Expand Down