fix: hostname validation when provided by config
This commit is contained in:
parent
4445ef6432
commit
97733cbf43
@ -2,6 +2,7 @@ import subprocess
|
||||
import os
|
||||
import logging
|
||||
import time
|
||||
import re
|
||||
import pwnagotchi.ui.view as view
|
||||
|
||||
version = '1.1.0b'
|
||||
@ -17,6 +18,10 @@ def set_name(new_name):
|
||||
if new_name == '':
|
||||
return
|
||||
|
||||
if not re.match(r'^[a-zA-Z0-9\-]{2,25}$', new_name):
|
||||
logging.warning("name '%s' is invalid: min length is 2, max length 25, only a-zA-Z0-9- allowed", new_name)
|
||||
return
|
||||
|
||||
current = name()
|
||||
if new_name != current:
|
||||
global _name
|
||||
|
@ -6,7 +6,7 @@
|
||||
#
|
||||
# main algorithm configuration
|
||||
main:
|
||||
# if set this will set the hostname of the unit
|
||||
# if set this will set the hostname of the unit. min length is 2, max length 25, only a-zA-Z0-9- allowed
|
||||
name: ''
|
||||
# currently implemented: en (default), de, el, fr, it, mk, nl, ru, se, pt-BR, es, pt
|
||||
lang: en
|
||||
|
Loading…
x
Reference in New Issue
Block a user