def post(self): args = parser.parse_args() password = args.get('password') username = args.get('username') name = args.get('name') logging.debug("sign up {}".format(username)) people = People.getbyusername(username) if people: logging.debug("username already taken") raise UserAlreadyExistsError else: people = People.create(name, username) people.get().genpass(password) user = User.get(username) if user is None: user = User.get(username) logging.warning("User get retry") if user is not None: login_user(user, remember=True) else: logging.warning("Still not found") return { 'id': people.id(), "username": username, "name": name, "admin": False }
def post(self): args = password_parser.parse_args() password = args.get('password') username = args.get('email') people = People.getbyusername(username) if people: people.genpass(password) else: raise PeopleNotExistsError return True
def __init__(self, username): logging.debug("Login {}".format(username)) people = People.getbyusername(username) if not people: raise UserNotFoundError self.username = username self.name = people.name self.id = people.username self.key_id = people.key.id() self.password = people.password
def post(self): logging.debug("creating people") args = parser.parse_args() people_details = args if People.getbyusername(args.get('username')): logging.warning("Username already taken") raise UserAlreadyExistsError else: people = People.create(args.get('name'), args.get('username')) people.get().genpass(args.get('password')) people_details['id'] = people.id() return {'people': people_details}
def post(self): args = parser.parse_args() password = args.get('password') username = args.get('username') login_status = False people = None if username and password: people = People.getbyusername(username) login_status = True if people and people.validpassword(password) else False if login_status: login_user(User.get(username), remember=True) if not login_status: raise InvalidLoginError return {"username": username, "name": people.name, "position": people.position,"admin": people.admin, "id": people.key.id()}
def post(self): args = parser.parse_args() password = args.get('password') username = args.get('username') name = args.get('name') logging.debug("sign up {}".format(username)) people = People.getbyusername(username) if people: logging.debug("username already taken") raise UserAlreadyExistsError else: people = People.create(name, username) people.get().genpass(password) user = User.get(username) if user is None: user = User.get(username) logging.warning("User get retry") if user is not None: login_user(user, remember=True) else: logging.warning("Still not found") return {'id': people.id(), "username": username, "name": name, "admin": False}
def post(self): args = parser.parse_args() password = args.get('password') username = args.get('username') login_status = False people = None if username and password: people = People.getbyusername(username) login_status = True if people and people.validpassword( password) else False if login_status: login_user(User.get(username), remember=True) if not login_status: raise InvalidLoginError return { "username": username, "name": people.name, "position": people.position, "admin": people.admin, "id": people.key.id() }