Beispiel #1
0
def new_user(login, content):

	
	if "pwd" not in content:
		return jsonify(status="error", error_type="bad parameter", missing="pwd")

	#user credentials check
	ulogin = login
	upwd = content["pwd"]

	reqUser = User(ulogin)
	if(reqUser.userExists(ulogin)):
		return jsonify(status="error", error_type="user exists")
	
	print("adding user")
	reqUser.createUser(ulogin, upwd)
	return jsonify(status="ok", info="user created")
Beispiel #2
0
def new_user():

	content = request.json
	params = ["login", "pwd"]
	missing = []
	for p in params:
		if p not in content:
			missing.append(p)
	
	if len(missing) != 0:
		return jsonify(status="error", error_type="bad parameter", missing=missing)


	#user credentials check
	ulogin = content["login"]
	upwd = content["pwd"]

	reqUser = User(ulogin)
	if(reqUser.userExists(ulogin)):
		return jsonify(status="error", error_type="user exists")
	
	print("adding user")
	reqUser.createUser(ulogin, upwd)
	return jsonify(status="ok", info="user created")