Add wifi sharing as a card, new settings for lan url, root and ssh
This commit is contained in:
parent
947b4ac59a
commit
ed1b03a609
52 changed files with 9067 additions and 94 deletions
24
app/forms.py
24
app/forms.py
|
|
@ -1,8 +1,16 @@
|
|||
from flask_wtf import FlaskForm
|
||||
from flask_wtf.file import FileAllowed, FileRequired
|
||||
from wtforms import StringField, PasswordField, SubmitField, BooleanField, FileField
|
||||
from wtforms.validators import DataRequired
|
||||
from wtforms import StringField, PasswordField, SubmitField, BooleanField, FileField, RadioField
|
||||
from wtforms.validators import DataRequired, ValidationError, Length
|
||||
from flask_babel import lazy_gettext as _l
|
||||
import re
|
||||
|
||||
def hostname_check(form, field):
|
||||
regex= re.compile("[a-zA-Z0-9-_]+")
|
||||
matches = re.fullmatch(regex, field.data)
|
||||
if not matches:
|
||||
raise ValidationError(_l('Only dashes, underscores, letters and numbers allowed'))
|
||||
|
||||
|
||||
class LoginForm(FlaskForm):
|
||||
username = StringField(_l('Username'), validators=[DataRequired()])
|
||||
|
|
@ -13,8 +21,8 @@ class LoginForm(FlaskForm):
|
|||
|
||||
class SettingsForm(FlaskForm):
|
||||
# Access point settings
|
||||
ssid = StringField('SSID', validators=[DataRequired()])
|
||||
wifi_password = StringField(_l('WiFi Password'))
|
||||
ssid = StringField(_l('SSID'), validators=[DataRequired(), Length(1, 64), hostname_check])
|
||||
wifi_password = StringField(_l('WiFi Password'), validators=[Length(0, 64)])
|
||||
enable_access_point = BooleanField(_l('Enable Access Point'))
|
||||
# Customisation settings
|
||||
butterbox_name = StringField(_l('Butterbox Name'), validators=[DataRequired()])
|
||||
|
|
@ -25,9 +33,15 @@ class SettingsForm(FlaskForm):
|
|||
enable_chat = BooleanField(_l('Enable Chat'))
|
||||
enable_app_store = BooleanField(_l('Enable App Store'))
|
||||
enable_deltachat = BooleanField(_l('Enable DeltaChat'))
|
||||
enable_wifi_sharing = BooleanField(_l('Enable WiFi Sharing'))
|
||||
# Access Settings
|
||||
admin_password = PasswordField(_l('Admin Password'))
|
||||
ssh_password = PasswordField(_l('SSH Password'))
|
||||
|
||||
root_account_settings= RadioField(_l('Secure Root Account Method'), choices=[ ('lock_root_account', 'Lock root account'), ( 'set_root_password', 'Set root password')], validators=[DataRequired()])
|
||||
ssh_access_settings = RadioField(_l('SSH Access Method'), choices=[ ('disable_ssh', 'Disable SSH'), ( 'enable_ssh_with_root_password', 'Enable SSH with root password'), ('enable_ssh_with_public_key', 'Enable SSH with public key'), ], validators=[DataRequired()])
|
||||
|
||||
lock_root_account = BooleanField(_l('Lock Root Account'))
|
||||
butterbox_hostname = StringField(_l('Butterbox Hostname'), validators=[DataRequired(), Length(1, 64), hostname_check])
|
||||
|
||||
submit = SubmitField(_l('Submit'))
|
||||
apply_changes = SubmitField(_l('Apply Changes'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue