def update_profile(request): message = '' if 'form.submitted' in request.params: message = user_service.update_user(request) login = request.params['login'] name = request.params['name'] email = request.params['email'] phone = request.params['phone'] user_id = request.params['id'] else: login = get_user_login(request) user = user_service.get_user_by_login(login) user_id = user.id name = user.name email = user.email phone = user.phone return dict( message=message, id=user_id, login=login, name=name, email=email, phone=phone, )
def get_user_id(request): principals = effective_principals(request) for principal in principals: if type(principal) is unicode: user = user_service.get_user_by_login(principal) return user.id return None
def check_login(request): if 'login' in request.params: login = request.params['login'] user = user_service.get_user_by_login(login) if (user == None): return True if 'id' in request.params: if user.id == int(request.params['id']): return True localizer = get_localizer(request) message_ts = _('login_already_use', domain='Ondestan') return localizer.translate(message_ts)