def bind(self, args): if current_user.is_user(): if current_user.email: abort(BINDED) current_user.email = args['email'] if um.config.required_bind_password: current_user.password = args['password'] current_user.save() return current_user user = um.models.User.objects(email=args['email']).first() if not user: user = um.models.User( email=args['email'], password=args['password'] if um.config.required_bind_password else '', channel=get_channel(), spm=get_spm(), ip=get_ip(), ) user.create() elif um.config.required_bind_password and user.password != args[ 'password']: abort(PASSWORD_ERROR) return user
def create(self, args): user = um.models.User( email=args['email'], password=args['password'], channel=get_channel(), spm=get_spm(), ip=get_ip(), ) user.create() return user
def bind(self, args): user = um.models.User.objects(email=args['email']).first() if not user: user = um.models.User( email=args['email'], password=args['password'], channel=get_channel(), spm=get_spm(), ip=get_ip(), ) user.create() elif user.password != args['password']: abort(PASSWORD_ERROR) return user
def bind(self, args): if current_user.is_user(): if current_user.phone: abort(BINDED) current_user.phone = args['phone'] current_user.password = args['password'] current_user.save() return current_user user = um.models.User.objects(phone=args['phone']).first() if not user: user = um.models.User( phone=args['phone'], password=args['password'], channel=get_channel(), spm=get_spm(), ip=get_ip(), ) user.create() elif user.password != args['password']: abort(PASSWORD_ERROR) return user
def log(type, id, device, key='', spm=None, ip=None): spm = spm if spm else get_spm() ip = ip if ip else get_ip() UserLog(user=id, type=type, device=device, key=key, spm=spm, ip=ip).save()
def create_empty(): return um.models.User(channel=get_channel(), spm=get_spm(), ip=get_ip())
def create_empty(): return User(channel=get_channel(), spm=get_spm(), ip=get_ip())