Ejemplo n.º 1
0
try:
    setup = configparser.RawConfigParser(delimiters=('='),
                                         inline_comment_prefixes=('#', ';'))
    setup.read(setupini)
    serverip = setup.get('setup', 'serverip')
    printScript(' Success!', '', True, True, False, len(msg))
except:
    printScript(' Failed!', '', True, True, False, len(msg))
    sys.exit(1)

# test adminpw
try:
    adminpw = setup.get('setup', 'adminpw')
except:
    adminpw = ''
if not isValidPassword(adminpw):
    printScript('There is no admin password!')
    adminpw = enterPassword('admin', True)
    if not isValidPassword(adminpw):
        printScript('No valid admin password! Aborting!')
        sys.exit(1)
    else:
        msg = 'Saving admin password to setup.ini '
        printScript(msg, '', False, False, True)
        rc = modIni(constants.SETUPINI, 'setup', 'adminpw', adminpw)
        if rc == True:
            printScript(' Success!', '', True, True, False, len(msg))
        else:
            printScript(' Failed!', '', True, True, False, len(msg))
            sys.exit(1)
                break
        print('SMTP Password: '******'setup', 'smtppw', smtppw)

# global admin password
ititle = title + ': Administrator password'
adminpw = ''
adminpw_repeated = ''
while True:
    rc, adminpw = dialog.passwordbox(
        'Enter the Administrator password (Note: Input will be unvisible!). Minimal length is 7 characters. Use upper and lower and special characters or numbers (e.g. mUster!):',
        title=ititle,
        insecure=True)
    if rc == 'cancel':
        sys.exit(1)
    if isValidPassword(adminpw):
        while True:
            rc, adminpw_repeated = dialog.passwordbox(
                'Re-enter the Administrator password:'******'cancel':
                sys.exit(1)
            if isValidPassword(adminpw_repeated):
                break
    if adminpw == adminpw_repeated:
        break

print('Administrator password: '******'setup', 'adminpw', adminpw)
Ejemplo n.º 3
0
            if rc == 'cancel':
                sys.exit(1)
            if smtppw != '':
                break
        print('SMTP Password: '******'setup', 'smtppw', smtppw)

# global admin password
ititle = title + ': Administrator password'
while True:
    rc, adminpw = dialog.passwordbox(
        'Enter the Administrator password (Note: Input will be unvisible!):',
        title=ititle)
    if rc == 'cancel':
        sys.exit(1)
    if isValidPassword(adminpw):
        break
while True:
    rc, adminpw_repeated = dialog.passwordbox(
        'Re-enter the Administrator password:'******'cancel':
        sys.exit(1)
    if adminpw == adminpw_repeated:
        break

print('Administrator password: '******'setup', 'adminpw', adminpw)

# write INIFILE
msg = 'Writing input to setup ini file '
printScript(msg, '', False, False, True)