mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
commit
95fbf9527f
@ -68,7 +68,7 @@ some other websites business model.</p>
|
|||||||
main="""
|
main="""
|
||||||
"""
|
"""
|
||||||
form = Form(title="Configuration",
|
form = Form(title="Configuration",
|
||||||
action="/apps/owncloud",
|
action=cfg.server_dir + "/apps/owncloud",
|
||||||
name="configure_owncloud",
|
name="configure_owncloud",
|
||||||
message='')
|
message='')
|
||||||
form.checkbox(_("Enable Owncloud"), name="owncloud_enable", id="owncloud_enable", checked=checkedinfo['enable'])
|
form.checkbox(_("Enable Owncloud"), name="owncloud_enable", id="owncloud_enable", checked=checkedinfo['enable'])
|
||||||
|
|||||||
@ -81,11 +81,11 @@ class FirstBoot(PagePlugin):
|
|||||||
## Update state to 1 and head there
|
## Update state to 1 and head there
|
||||||
with sqlite_db(cfg.store_file, table="firstboot", autocommit=True) as db:
|
with sqlite_db(cfg.store_file, table="firstboot", autocommit=True) as db:
|
||||||
db['state']=1
|
db['state']=1
|
||||||
raise cherrypy.InternalRedirect('firstboot/state1')
|
raise cherrypy.InternalRedirect('state1')
|
||||||
|
|
||||||
main = "<p>Welcome. It looks like this FreedomBox isn't set up yet. We'll need to ask you a just few questions to get started.</p>"
|
main = "<p>Welcome. It looks like this FreedomBox isn't set up yet. We'll need to ask you a just few questions to get started.</p>"
|
||||||
form = Form(title="Welcome to Your FreedomBox!",
|
form = Form(title="Welcome to Your FreedomBox!",
|
||||||
action="firstboot",
|
action="", # stay at firstboot
|
||||||
name="whats_my_name",
|
name="whats_my_name",
|
||||||
message=message)
|
message=message)
|
||||||
form.html("<p>For convenience, your FreedomBox needs a name. It should be something short that doesn't contain spaces or punctuation. 'Willard' would be a good name. 'Freestyle McFreedomBox!!!' would not.</p>")
|
form.html("<p>For convenience, your FreedomBox needs a name. It should be something short that doesn't contain spaces or punctuation. 'Willard' would be a good name. 'Freestyle McFreedomBox!!!' would not.</p>")
|
||||||
@ -123,7 +123,7 @@ TODO: explain all this cert stuff to the user.</p>
|
|||||||
with sqlite_db(cfg.store_file, table="firstboot", autocommit=True) as db:
|
with sqlite_db(cfg.store_file, table="firstboot", autocommit=True) as db:
|
||||||
db['state']=5
|
db['state']=5
|
||||||
main = main + """
|
main = main + """
|
||||||
<p>Welcome screen not completely implemented yet. Press <a href="router">continue</a> to
|
<p>Welcome screen not completely implemented yet. Press <a href="../router">continue</a> to
|
||||||
see the rest of the web interface.</p>"
|
see the rest of the web interface.</p>"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ see the rest of the web interface.</p>"
|
|||||||
with sqlite_db(cfg.store_file, table="firstboot", autocommit=True) as db:
|
with sqlite_db(cfg.store_file, table="firstboot", autocommit=True) as db:
|
||||||
db['state']=1
|
db['state']=1
|
||||||
#TODO: switch to HTTPS
|
#TODO: switch to HTTPS
|
||||||
raise cherrypy.InternalRedirect('firstboot/state1')
|
raise cherrypy.InternalRedirect('state1')
|
||||||
|
|
||||||
return self.fill_template(template="base", title=_("Installing the Certificate"), main=main,
|
return self.fill_template(template="base", title=_("Installing the Certificate"), main=main,
|
||||||
sidebar_right=_("""<strong>Getting Help</strong><p>We've done our best to make your FreedomBox easy to use. If you have questions during setup, there are a few places to turn for help. TODO: add links to such help.</p>"""))
|
sidebar_right=_("""<strong>Getting Help</strong><p>We've done our best to make your FreedomBox easy to use. If you have questions during setup, there are a few places to turn for help. TODO: add links to such help.</p>"""))
|
||||||
|
|||||||
@ -57,10 +57,10 @@ def check_auth(*args, **kwargs):
|
|||||||
# A condition is just a callable that returns true or false
|
# A condition is just a callable that returns true or false
|
||||||
if not condition():
|
if not condition():
|
||||||
# Send old page as from_page parameter
|
# Send old page as from_page parameter
|
||||||
raise cherrypy.HTTPRedirect("/auth/login?from_page=%s" % get_params)
|
raise cherrypy.HTTPRedirect(cfg.server_dir + "/auth/login?from_page=%s" % get_params)
|
||||||
else:
|
else:
|
||||||
# Send old page as from_page parameter
|
# Send old page as from_page parameter
|
||||||
raise cherrypy.HTTPRedirect("/auth/login?from_page=%s" % get_params)
|
raise cherrypy.HTTPRedirect(cfg.server_dir + "/auth/login?from_page=%s" % get_params)
|
||||||
|
|
||||||
cherrypy.tools.auth = cherrypy.Tool('before_handler', check_auth)
|
cherrypy.tools.auth = cherrypy.Tool('before_handler', check_auth)
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ class AuthController(PagePlugin):
|
|||||||
"""Called on logout"""
|
"""Called on logout"""
|
||||||
|
|
||||||
def get_loginform(self, username, msg='', from_page="/"):
|
def get_loginform(self, username, msg='', from_page="/"):
|
||||||
form = Form(title="Login", action="/auth/login", message=msg)
|
form = Form(title="Login", action=cfg.server_dir + "/auth/login", message=msg)
|
||||||
form.text_input(name="from_page", value=from_page, type="hidden")
|
form.text_input(name="from_page", value=from_page, type="hidden")
|
||||||
form.text_input("Username", name="username", value=username)
|
form.text_input("Username", name="username", value=username)
|
||||||
form.text_input("Passphrase", name="passphrase", type="password")
|
form.text_input("Passphrase", name="passphrase", type="password")
|
||||||
@ -36,7 +36,7 @@ class AuthController(PagePlugin):
|
|||||||
else:
|
else:
|
||||||
cherrypy.session[cfg.session_key] = cherrypy.request.login = username
|
cherrypy.session[cfg.session_key] = cherrypy.request.login = username
|
||||||
self.on_login(username)
|
self.on_login(username)
|
||||||
raise cherrypy.HTTPRedirect(from_page or "/")
|
raise cherrypy.HTTPRedirect(from_page or (cfg.server_dir + "/"))
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def logout(self, from_page="/"):
|
def logout(self, from_page="/"):
|
||||||
@ -46,4 +46,4 @@ class AuthController(PagePlugin):
|
|||||||
if username:
|
if username:
|
||||||
cherrypy.request.login = None
|
cherrypy.request.login = None
|
||||||
self.on_logout(username)
|
self.on_logout(username)
|
||||||
raise cherrypy.HTTPRedirect(from_page or "/")
|
raise cherrypy.HTTPRedirect(from_page or (cfg.server_dir + "/"))
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class router(PagePlugin):
|
|||||||
reflect that we've moved down into the submenu hierarchy.
|
reflect that we've moved down into the submenu hierarchy.
|
||||||
Otherwise, it's hard to know which menu portion to make active
|
Otherwise, it's hard to know which menu portion to make active
|
||||||
or expand or contract."""
|
or expand or contract."""
|
||||||
raise cherrypy.HTTPRedirect('/router/setup')
|
raise cherrypy.HTTPRedirect(cfg.server_dir + '/router/setup')
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@require()
|
@require()
|
||||||
@ -138,7 +138,7 @@ class wan(FormPlugin, PagePlugin):
|
|||||||
exec("if not '%(k)s' in kwargs: store['%(k)s'] = kwargs['%(k)s'] = %(c)s" % {'k':k, 'c':c})
|
exec("if not '%(k)s' in kwargs: store['%(k)s'] = kwargs['%(k)s'] = %(c)s" % {'k':k, 'c':c})
|
||||||
|
|
||||||
form = Form(title="WAN Connection",
|
form = Form(title="WAN Connection",
|
||||||
action="/router/setup/wan/index",
|
action=cfg.server_dir + "/router/setup/wan/index",
|
||||||
name="wan_connection_form",
|
name="wan_connection_form",
|
||||||
message=message)
|
message=message)
|
||||||
form.dropdown('Connection Type', vals=["DHCP", "Static IP"], id="connect_type", onchange="hideshow_static()")
|
form.dropdown('Connection Type', vals=["DHCP", "Static IP"], id="connect_type", onchange="hideshow_static()")
|
||||||
|
|||||||
@ -43,7 +43,7 @@ class xmpp(PagePlugin):
|
|||||||
|
|
||||||
main = "<p>XMPP Server Configuration</p>"
|
main = "<p>XMPP Server Configuration</p>"
|
||||||
form = Form(title="Configuration",
|
form = Form(title="Configuration",
|
||||||
action="/services/xmpp",
|
action=cfg.server_dir + "/services/xmpp",
|
||||||
name="configure_xmpp",
|
name="configure_xmpp",
|
||||||
message='')
|
message='')
|
||||||
form.checkbox(_("Allow In-Band Registration"), name="xmpp_inband_enable",
|
form.checkbox(_("Allow In-Band Registration"), name="xmpp_inband_enable",
|
||||||
@ -66,7 +66,7 @@ class register(FormPlugin, PagePlugin):
|
|||||||
|
|
||||||
def main(self, username='', message=None, *args, **kwargs):
|
def main(self, username='', message=None, *args, **kwargs):
|
||||||
form = Form(title="Register XMPP Account",
|
form = Form(title="Register XMPP Account",
|
||||||
action="/services/xmpp/register/index",
|
action=cfg.server_dir + "/services/xmpp/register/index",
|
||||||
name="register_xmpp_form",
|
name="register_xmpp_form",
|
||||||
message=message)
|
message=message)
|
||||||
form.text_input(_("Username"), name="username", value=username)
|
form.text_input(_("Username"), name="username", value=username)
|
||||||
|
|||||||
@ -19,7 +19,7 @@ class Sharing(PagePlugin):
|
|||||||
reflect that we've moved down into the submenu hierarchy.
|
reflect that we've moved down into the submenu hierarchy.
|
||||||
Otherwise, it's hard to know which menu portion to make active
|
Otherwise, it's hard to know which menu portion to make active
|
||||||
or expand or contract."""
|
or expand or contract."""
|
||||||
raise cherrypy.HTTPRedirect('/sharing/files')
|
raise cherrypy.HTTPRedirect(cfg.server_dir + '/sharing/files')
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@require()
|
@require()
|
||||||
|
|||||||
@ -112,7 +112,7 @@ class general(FormPlugin, PagePlugin):
|
|||||||
|
|
||||||
## And now, the form.
|
## And now, the form.
|
||||||
form = Form(title=_("General Config"),
|
form = Form(title=_("General Config"),
|
||||||
action="/sys/config/general/index",
|
action=cfg.server_dir + "/sys/config/general/index",
|
||||||
name="config_general_form",
|
name="config_general_form",
|
||||||
message=message )
|
message=message )
|
||||||
form.html(self.help())
|
form.html(self.help())
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class experts(FormPlugin, PagePlugin):
|
|||||||
expert = cfg.users.expert()
|
expert = cfg.users.expert()
|
||||||
cfg.log("Expert mode is %s" % expert)
|
cfg.log("Expert mode is %s" % expert)
|
||||||
form = Form(title=_("Expert Mode"),
|
form = Form(title=_("Expert Mode"),
|
||||||
action="/sys/config/experts",
|
action=cfg.server_dir + "/sys/config/experts",
|
||||||
name="expert_mode_form",
|
name="expert_mode_form",
|
||||||
message=message )
|
message=message )
|
||||||
form.html(self.help())
|
form.html(self.help())
|
||||||
|
|||||||
@ -33,7 +33,7 @@ class add(FormPlugin, PagePlugin):
|
|||||||
|
|
||||||
def main(self, username='', name='', email='', message=None, *args, **kwargs):
|
def main(self, username='', name='', email='', message=None, *args, **kwargs):
|
||||||
form = Form(title="Add User",
|
form = Form(title="Add User",
|
||||||
action="/sys/users/add/index",
|
action=cfg.server_dir + "/sys/users/add/index",
|
||||||
onsubmit="return md5ify('add_user_form', 'password')",
|
onsubmit="return md5ify('add_user_form', 'password')",
|
||||||
name="add_user_form",
|
name="add_user_form",
|
||||||
message=message)
|
message=message)
|
||||||
@ -80,7 +80,7 @@ class edit(FormPlugin, PagePlugin):
|
|||||||
|
|
||||||
def main(self, msg=''):
|
def main(self, msg=''):
|
||||||
users = cfg.users.get_all()
|
users = cfg.users.get_all()
|
||||||
add_form = Form(title=_("Edit or Delete User"), action="/sys/users/edit", message=msg)
|
add_form = Form(title=_("Edit or Delete User"), action=cfg.server_dir + "/sys/users/edit", message=msg)
|
||||||
add_form.html('<span class="indent"><strong>Delete</strong><br /></span>')
|
add_form.html('<span class="indent"><strong>Delete</strong><br /></span>')
|
||||||
for uname in users:
|
for uname in users:
|
||||||
user = User(uname[1])
|
user = User(uname[1])
|
||||||
|
|||||||
@ -57,7 +57,7 @@ class wan(FormPlugin, PagePlugin):
|
|||||||
exec("if not '%(k)s' in kwargs: store['%(k)s'] = kwargs['%(k)s'] = %(c)s" % {'k':k, 'c':c})
|
exec("if not '%(k)s' in kwargs: store['%(k)s'] = kwargs['%(k)s'] = %(c)s" % {'k':k, 'c':c})
|
||||||
|
|
||||||
form = Form(title=_("Accessing the %s" % cfg.box_name),
|
form = Form(title=_("Accessing the %s" % cfg.box_name),
|
||||||
action="/sys/config/wan",
|
action=cfg.server_dir + "/sys/config/wan",
|
||||||
name="admin_wan_form",
|
name="admin_wan_form",
|
||||||
message=message )
|
message=message )
|
||||||
form.html(self.help())
|
form.html(self.help())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user