示例#1
0
	def get(self, **kwargs):
		collection = RethinkCollection(self, filter=kwargs)
		results = collection.fetch()

		if results:
			return results[0]
		else:
			return None
示例#2
0
	def auth_user(self, email, password):
		collection = RethinkCollection(self, filter={'email': email})
		get_user = collection.fetch()

		user = {}
		if not get_user:
			user['status'] = False
			user['is_user'] = False
			return user
		else:
			valid_password = check_password_hash(get_user[0]['password'],
												 password)
			if not valid_password:
				user['status'] = False
				user['valid_password'] = False
				user['is_user'] = True
				return user

		user['status'] = True
		return user