コード例 #1
0
	def post(self):
		try:
			data = SignupApi.parser.parse_args()
			email = data.email
			password = data.password
			if User.get_user_by_email(email):
	        	    return {"message": "A user with that username already exists"}, 400
			user = User(email, password)
			user.save_record()
			user = User.get_user_by_email(email)
			access_token = create_access_token(identity=user.id, fresh = True)
			return {"access_token": access_token}, 200
		except Exception as e:
			print(str(e))