Exemplo n.º 1
0
    account_number = form_entries.getvalue("account_number")
    bank_name = form_entries.getvalue("bank_name")
    branch_name = form_entries.getvalue("branch_name")
    ifsc_code = form_entries.getvalue("ifsc_code")
except Exception as e:
    mlog.error(TAG,"Error: " + str(e))

#if invalid attributes, show error and eixt.
error_message = None
if(full_name == None or login_name == None or login_key == None or login_key_confirm == None or account_number == None or bank_name == None or branch_name == None or ifsc_code == None) :
    error_message = "<br><p>Failed to register! Invalid attributes provided. Register again with valid attributes</p>"
else:
    register_validator = Validator()
    if register_validator.validate_generic_name(full_name,6,15) == False:
        error_message = register_validator.message
    elif register_validator.validate_login_name(login_name,6,15) == False:
        error_message = register_validator.message
    elif register_validator.validate_login_key(login_key,6,12) == False:
        error_message = register_validator.message
    elif login_key != login_key_confirm:
        error_message = "<P>Passwords do not match!</p>"
    elif int(account_number)<10000 or int(account_number) > 999999:
        error_message = "<P>Account number must be greater than 10000 and less than 999999!</p>"
    elif register_validator.validate_bank_name(bank_name,3,10) == False:
        error_message = register_validator.message
    elif register_validator.validate_branch_name(branch_name,5,10) == False:
        error_message = register_validator.message
    elif register_validator.validate_ifsc_code(ifsc_code) == False:
        error_message = register_validator.message

mlog.error(TAG,"Register validator error message: " + str(error_message))
Exemplo n.º 2
0
login_key_confirm = ""
mlog.debug(TAG,"Fetching form values..")
try:
    form_entries = cgi.FieldStorage()
    login_name = form_entries.getvalue("login_name")
    login_key = form_entries.getvalue("login_key")
    login_key_confirm = form_entries.getvalue("login_key_confirm")
except Exception as e:
    mlog.error(TAG,"Error: " + str(e))

error_message = None
if(login_name == None or login_key == None or login_key_confirm == None) :
    error_message = "<br><p>Failed to change password! Invalid attributes provided. Try again with valid attributes</p>"
else:
    reset_validator = Validator()
    if reset_validator.validate_login_name(login_name,6,15) == False:
        error_message = reset_validator.message
    elif reset_validator.validate_login_key(login_key,6,12) == False:
        error_message = reset_validator.message
    elif login_key != login_key_confirm:
        error_message = "<P>New password and confirm passwords did not match!</p>"

mlog.error(TAG,"Reset password validator error message: " + str(error_message))
if error_message != None:
    print('''
        <div id="entry" >        
            <p>Failed to reset password:</p>
            <div id="entry" >
    ''')
    print(error_message)
    print('''</div></div>''')
Exemplo n.º 3
0
cgitb.enable()
print(helperHTML.get_html_init())
login_name = ""
login_key = ""
mlog.debug(TAG, "Fetching form values..")
try:
    form_entries = cgi.FieldStorage()
    login_name = form_entries.getvalue("login_name")
    login_key = form_entries.getvalue("login_key")
except Exception as e:
    mlog.error(TAG, "Error: " + str(e))

#if invalid attributes, show error and eixt.
error_message = None
login_validator = Validator()
if login_validator.validate_login_name(login_name, 6, 10) == False:
    error_message = login_validator.message
elif login_validator.validate_login_key(login_key, 6, 10) == False:
    error_message = login_validator.message

mlog.error(TAG, "login validator error message: " + str(error_message))
if error_message != None:
    print(helperHTML.get_html_start_preset())
    print('''
        <h4>Failed to login:</h4>
        <div id="entry" >
    ''')
    print(error_message)
    print('''
        </div>
        <div id="entry" >