def change_pass(self): current_pass = request.args.get("current_pass") new_pass = request.args.get("new_pass") if current_user.authenticate(current_pass): if new_pass: changePassword(current_user.id, new_pass) return jsonify({"status": "password_changed"}) return jsonify({"status": "no_password"}) else: return jsonify({"status": "wrong_user_pass"})
if userExists(username): sys.exit(exits["userInDb"]) # set master if db is empty if getSize(col) > 0: masterLogin() password = promptNewPass() addUser(username, password, localOnly=args.l) else: password = promptNewPass() addUser(username, password, admin=True, localOnly=args.l) sys.exit("User added") elif args.c: username = args.c verifyPass(getpass.getpass("Old password:"******"Password updated") elif args.r: username = args.r if not userExists(username): sys.exit(exits["userNotInDb"]) masterLogin() isLastAdmin(username) deleteUser(username) sys.exit("User removed from database") elif args.p: username = args.p if not userExists(username): sys.exit(exits["userNotInDb"]) masterLogin() # promote