def register_check(username, password1, password2, email, sessionID): result = db.check_username(username) if result == 1: return html.render(html.render_navbar(), html.register_html.has_been_registed) if password1 != password2: return html.render(html.render_navbar(), html.register_html.password_not_same) db.user_register(username, password1, email, sessionID) return html.render(html.render_navbar(username))
def change_pass_check(password, newPassword1, newPassword2, sessionID): ret = sess.check_login(sessionID) if newPassword1 != newPassword2: return html.render(html.render_navbar(ret), html.changePass_html.no_same_password) if db.check_password(ret, password) == "WrongPassword": return html.render(html.render_navbar(username=ret), html.changePass_html.false_old_password) db.update_pass(ret, newPassword1) return html.render(html.render_navbar(username=ret))
def login_check(username, password, sessionID): ret = sess.check_client_login(username=username) # print("ret: " + str(ret)) if ret == 1: check_result = db.check_password(username, password) if check_result == "Pass": sess.set_client_name(username, sessionID) return html.render(html.render_navbar(username)) elif check_result == "WrongPassword": return html.render(html.render_navbar(), html.login_html.wrong_password) elif check_result == "WrongUsername": return html.render(html.render_navbar(), html.login_html.no_user_found) elif ret == 0: return html.render(html.render_navbar(), html.login_html.already_login)
if os.path.isfile(dbFile): W = serialization_json.fromFile(dbFile) else: W = [] W.append(workUnit) serialization_json.toFile(dbFile, W) if __name__ == "__main__": dbFile = options.dbFile htmlFile = options.htmlFile args = getArgs() if args.edit_db is True: cmd = "vim %s" % options.dbFile print(cmd) os.system(cmd) exit(0) if args.open_browser is True: webbrowser.open_new_tab(htmlFile) exit(0) if not args.regen_html: commandLineEnterWorkDone(dbFile) wd = serialization_json.fromFile(dbFile) render_html.render(wd, htmlFile, options.dataFile)
def login_request(username): return html.render(html.render_navbar(username), html.register_html.already_login)
def changePass_request(): return html.render(html.render_navbar(), html.changePass_html.no_login)
def logout_check(sessionID): sess.update_login(sessionID=sessionID) return html.render(html.render_navbar())