def __init__(self, request): self.request = request self.name = self.request.POST.get('name') self.surname = self.request.POST.get('surname') self.username = self.request.POST.get('username') self.pwd = self.request.POST.get('password') self.user = User()
class PostHandler: def __init__(self, request): self.request = request self.username = self.request.POST.get('username') self.old_pwd = self.request.POST.get('old_pwd') self.new_pwd = self.request.POST.get('new_pwd') self.user = User() def handle_request(self): if self.request.POST.get('verify_old_pwd'): if self.user.exists_in_db(self.username, self.old_pwd): return HttpResponse(True, self.request) return HttpResponse(False, self.request) else: pwd_changed = self.user.change_password(self.username, self.old_pwd, self.new_pwd) if pwd_changed: return HttpResponse( '<script type="text/javascript">window.close(); ' 'window.opener.parent.location.href = "/iva/users.html?option=pwd_changed&username='******'";</script>') return HttpResponse( TEMPLATE.render({ 'username': self.username, 'error': True }, self.request))
def __init__(self, request): self.request = request self.old_username = self.request.POST.get('old_username') self.username = self.request.POST.get('username') self.surname = self.request.POST.get('surname') self.name = self.request.POST.get('name') self.user = User()
class PostHandler: def __init__(self, request): self.request = request self.option = self.request.POST.get('option') self.username = self.request.POST.get('username') self.user = User() def handle_request(self): if self.option == 'delete': self.user.delete_user(self.username) def create_http_response(self): return HttpResponse('OK')
class PostHandler: def __init__(self, request): self.request = request self.old_username = self.request.POST.get('old_username') self.username = self.request.POST.get('username') self.surname = self.request.POST.get('surname') self.name = self.request.POST.get('name') self.user = User() def handle_request(self): self.user.modify_user(self.old_username, self.username, self.name, self.surname) return HttpResponse('<script type="text/javascript">window.close(); ' 'window.opener.parent.location.href = "/iva/users.html";</script>')
class PostHandler: def __init__(self, request): self.request = request self.name = self.request.POST.get('name') self.surname = self.request.POST.get('surname') self.username = self.request.POST.get('username') self.pwd = self.request.POST.get('password') self.user = User() def handle_request(self): self.user.insert_new_user(self.name, self.surname, self.username, self.pwd) return HttpResponse( TEMPLATE_USERS.render({'users': self.user.get_users()}, self.request))
class GetHandler: def __init__(self, request): self.request = request self.context = {} self.user = User() def handle_request(self): if self.request.GET.get('option') == 'check_user': if self.user.exist_user_with_username( self.request.GET.get('username')): return HttpResponse({'exist'}, self.request) return HttpResponse({'not_exist': False}, self.request) return HttpResponse(TEMPLATE.render({}, self.request))
class GetHandler: def __init__(self, request): self.request = request self.option = self.request.GET.get('option') self.username = self.request.GET.get('username') self.user = User() def handle_request(self): pass def create_http_response(self): if self.option == 'pwd_changed': return HttpResponse( TEMPLATE.render(self.get_context_dict(), self.request)) return HttpResponse( TEMPLATE.render({'users': self.user.get_users()}, self.request)) def get_context_dict(self): return { 'users': self.user.get_users(), 'pwd_changed': True, 'username': self.username }
class GetHandler: def __init__(self, request): self.request = request self.username = self.request.GET.get('username') self.surname = self.request.GET.get('surname') self.name = self.request.GET.get('name') self.user = User() def handle_request(self): if self.request.GET.get('option') == 'check_user': if self.user.exist_user_with_username(self.username): return HttpResponse({'exist'}, self.request) return HttpResponse({'not_exist'}, self.request) return HttpResponse(TEMPLATE.render({'old_username': self.username, 'name': self.name, 'surname': self.surname}, self.request))
def __init__(self, request): self.request = request self.option = self.request.POST.get('option') self.username = self.request.POST.get('username') self.user = User()
def __init__(self, request): self.request = request self.context = {} self.user = User()
def __init__(self, request): self.request = request self.username = self.request.POST.get('username') self.old_pwd = self.request.POST.get('old_pwd') self.new_pwd = self.request.POST.get('new_pwd') self.user = User()
def create_dummy_user_if_no_user_exists(): user = User() if user.is_user_collection_empty() or is_test_mode(): user.create_dummy_user()