add option to shorten passphrase
This commit is contained in:
parent
c362e3e675
commit
080b88d43f
@ -159,6 +159,7 @@ def build_config(_config_file):
|
||||
'URL': config.get(section, 'URL'),
|
||||
'APPEND_INT': config.getint(section, 'APPEND_INT'),
|
||||
'SHARED_SECRET': config.get(section, 'SHARED_SECRET'),
|
||||
'SHORTEN_PASSPHRASE': config.getboolean(section, 'SHORTEN_PASSPHRASE'),
|
||||
|
||||
})
|
||||
|
||||
|
@ -148,6 +148,8 @@ URL: http://localhost:8080/auth
|
||||
APPEND_INT: 1
|
||||
# Secret used to authenticate with user managment server, before checking if user login is approved
|
||||
SHARED_SECRET: test
|
||||
# Shorten passphrases to 8 characters
|
||||
SHORTEN_PASSPHRASE: False
|
||||
|
||||
|
||||
# MASTER INSTANCES - DUPLICATE SECTION FOR MULTIPLE MASTERS
|
||||
|
@ -30,7 +30,11 @@ script_links = {}
|
||||
def gen_passphrase(dmr_id):
|
||||
_new_peer_id = bytes_4(int(str(dmr_id)[:7]))
|
||||
calc_passphrase = base64.b64encode(bytes.fromhex(str(hex(libscrc.ccitt((_new_peer_id) + append_int.to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + append_int.to_bytes(2, 'big'))))[2:].zfill(8)))))[2:].zfill(4)) + (_new_peer_id) + append_int.to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + append_int.to_bytes(2, 'big'))))[2:].zfill(8)))
|
||||
return str(calc_passphrase)[2:-1]
|
||||
print(calc_passphrase)
|
||||
if use_short_passphrase == True:
|
||||
return str(calc_passphrase)[-9:-1]
|
||||
elif use_short_passphrase ==False:
|
||||
return str(calc_passphrase)[2:-1]
|
||||
|
||||
def get_ids(callsign):
|
||||
try:
|
||||
|
@ -8,6 +8,8 @@ db_location = 'sqlite:///./users.db'
|
||||
# Legacy passphrase used in hblink.cfg
|
||||
legacy_passphrase = 'passw0rd'
|
||||
|
||||
# Trim passphrases to 8 characters
|
||||
use_short_passphrase = False
|
||||
|
||||
# Title of the Dashboard
|
||||
title = 'MMDVM User Portal'
|
||||
|
Loading…
Reference in New Issue
Block a user