def register(): name = input("Enter your name: ") while True: email = input("Enter your email: ") if email.find('@') != -1: break print("Invalid email") # password = getpass("Enter password: "******"Enter password: "******"Enter your password: ") result = controller.register(name, email, password) print(result.__str__())
pygame.init() # Create and register sensors. They start receiving messages as soon as they are registered # Image sensor image_sensor = imagesensor.ImageSensor(configuration) image_sensor.register(configuration.topic.camera.compressed) # Forward distance sensor forward_distance_sensor = distancesensor.DistanceSensor( configuration.sensor.distance.forward) forward_distance_sensor.register( configuration.sensor.distance.forward.topic) # Backward distance sensor backward_distance_sensor = distancesensor.DistanceSensor( configuration.sensor.distance.backward) backward_distance_sensor.register( configuration.sensor.distance.backward.topic) # Create and register the controller controller = controller.HybridController(configuration) controller.register() # Initialize this application as an ROS node, otherwise we can not communicate with the ROS system rospy.init_node(configuration.ros.node.name, anonymous=True) # Instantiate the pygame app app = application.App(configuration, image_sensor, controller, forward_distance_sensor, backward_distance_sensor) app.on_execute()
print('\t>>', notificacion['song_name'], ' - ', notificacion['art_name']) break else: print("Usted esta deshabilitado...\n") else: print("\nCredenciales incorrectos.\n") elif (o == "2"): print("\nGracias por ser parte de nuestra comunidad.") usuario = input("Nombre de usuario: ") contra = input("Ingrese su contraseña: ") contra2 = input("Repita su contraseña: ") if (contra == contra2): user_data = controller.register(usuario, contra) if (user_data): print("\n/ * Bienvenido ", user_data['username'], " * /") break else: print("\Ocurrió un problema al registrarse.\n") else: print("\nSus contraseñas no coinciden. \n") while (True): try: print("") #Menu de opciones print("MENU DE OPCIONES:") print("\t1) Buscar") print("\t2) Crear Playlist") print("\t3) Crear Album")
node.Node(controller, items[0], items[1], items[2:], SDN, SDN_STRATEGY, uptime=UPTIME) else: if NETWORK_ARCHITECTURE == "MESH": generate_network(controller) elif NETWORK_ARCHITECTURE == "ALBERTO": generate_network_alberto(controller) if SDN_STRATEGY not in ["BROADCAST", "FLOOD"]: controller.register(controller) controller.write_network_to_file("graph.dat") # Compute Minimum Spanning Tree if SDN_STRATEGY in ["BROADCAST"]: print("Computing Minimal Spanning Tree...") X = [0, 1] # The nodes in the MST controller.get_node(0).mst_edges.append(1) controller.get_node(1).mst_edges.append(0) controller_id = controller.get_node(0).controller_id index = 0 while (len(X) != NUMBER_OF_NODES): for n in controller.get_node(index).neighbors: if n not in X and n < NUMBER_OF_NODES: controller.get_node(index).mst_edges.append(n) controller.get_node(n).mst_edges.append(index)
def main_menu(): print( "Welcome to our bank service. You are not logged in. \nPlease register or login" ) while True: command = input("$$$>") if command == 'register': username = input("Enter your username: "******"Enter your password: "******"Enter your password: "******"Registration Successful") elif command == 'login': username = input("Enter your username: "******"Enter your password: "******"Login failed") elif command.startswith('send-reset-password'): username = command[20:] user_exists, user = validate_user(username) if not user_exists: print('No user with the username {} exists!'.format(username)) reset_token = generate_password_reset_token() email_was_sent = send_password_reset_token(user, reset_token) if not email_was_sent: print('There was an error with sending the e-mail!') return user.reset_code = reset_token elif command.startswith('reset-password'): username = command[15:] user_exists, user = validate_user(username) if not user_exists: print('No user with the username {} exists!'.format(username)) return reset_token = user.reset_code if not reset_token: print('There is no reset token for the user!') return given_reset_token = input('Please enter your reset token: ') if given_reset_token != reset_token: print('Invalid reset token!') return new_password = input('Enter your new password: '******'Enter your new password: '******'' user.password = new_password print('You have successfully reset your password!') elif command == 'help': print("login - for logging in!") print("register - for creating new account!") print("exit - for closing program!") elif command == 'exit': return else: print("Not a valid command")
def register(): return jsonify(control.register(request.form))