def check_auth(username, password): """This function is called to check if a username / password combination is valid. """ user = User.get_user(username) if user is None: return False return user.verify_password(password)
"port": RELMGR_CONFIG.neo4j_port, "type": "neo4j"}) from ariane_relsrv.server import restful myglobals = {"conf": RELMGR_CONFIG, "delivery_tree": ariane, "project_path": project_path, "relmgr_path": relmgr_path} # TODO: REMOVE LOOP DEPENDENCIES if RELMGR_CONFIG.testing or args.command == "relmgr": ArianeDefinitions.set_project_abs_path(project_path) restful.start_relmgr(myglobals) elif args.command in ["passwd", "add_user"]: if args.username and args.password: from ariane_relsrv.server.usersMgr import User User.users_file = RELMGR_CONFIG.users_file if args.command == "passwd": LOGGER.info("changing " + args.username + " password to " + args.password) ret = User.change_password(args.username, args.password) if ret == 0: LOGGER.info("Password of '"+args.username+"' has been changed") else: LOGGER.warn("The password has not been changed") elif args.command == "add_user": LOGGER.info("Adding user " + args.username) ret = User.create_user(args.username, args.password) if ret == 0: LOGGER.info("User '"+args.username+"' has been added") else: LOGGER.warn("User has not been added") else: LOGGER.warn("You must provide username (-u) and password (-p) to update the user password") LOGGER.warn("Example: 'relmgr.sh new_password -u myusername -p mynewpwd'") except Exception as e: