def my_signup(request): form = SignUpForm() if request.method == "POST": form = SignUpForm(request.POST) if form.is_valid(): user = form.save() user2 = authenticate(username=request.POST.get('username',''), password=request.POST.get('password','')) login(request,user2) return HttpResponseRedirect('/') return render(request, "my_signup.html", { 'form' : form });
def signup(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): user = models.User.objects.create_user(**form.cleaned_data) user.save() login(request, user) return HttpResponseRedirect(reverse('qa:main_page')) else: form = SignUpForm() return render(request, 'qa/signup.html', {'form': form})
def signup(request): err = '' if request.method == 'POST': signup_form = SignUpForm(request.POST) if signup_form.is_valid(): user = User.objects.create_user(signup_form.cleaned_data['username'], signup_form.cleaned_data['email'], signup_form.cleaned_data['password']) login(request, user) return HttpResponseRedirect(reverse('qa:main-list')) else: err = 'Неверный логин/пароль' else: signup_form = SignUpForm() return render(request, 'signup.html', {'err': err, 'form': signup_form})
def sign_up(request): if request.method == "POST": form = SignUpForm(request.POST) if form.is_valid(): username = request.POST['username'] password = request.POST['password'] form.save() user = authenticate(username = username, password = password) auth_login(request, user) return HttpResponseRedirect(reverse('homepage')) else: form = SignUpForm() return render(request, 'sign_up.html', { 'form' : form })
def signup(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): sessionid = form.save() if sessionid: url = request.GET.get('continue', '/') response = HttpResponseRedirect(url) response.set_cookie('sessionid', sessionid, '''domain='.site.com' ''', httponly=True, expires=datetime.now() + timedelta(days=5)) return response else: form = SignUpForm() return render(request, 'signup.html', { 'form': form })
def register(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): new_user = form.save() username = request.POST['username'] password = request.POST['password'] user = authenticate(username=username, password=password) if user is not None: login(request, user) return HttpResponseRedirect("/") else: form = SignUpForm() return render(request, "qa/register.html", { 'form' : form, })
def signup(request, *args, **kwargs): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): user = form.save() cleaned_data = form.clean() user = authenticate(username=cleaned_data['username'],\ password = cleaned_data['password']) login(request, user) url = '/' return HttpResponseRedirect(url) else: form = SignUpForm() return render(request, 'qa/SignUpForm.html', { 'form': form, } )
def signup(request): if request.method == "POST": form = SignUpForm(request.POST) if form.is_valid(): form.create_user() form.log_user_in(request) return HttpResponseRedirect("/") else: form = SignUpForm() return render(request, "qa/signup.html", { "form" : form })
def signup_page(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() prof_name = request.POST['login'] # prof_name = 'Chelsea' url = reverse('login_page') \ + '?success=Congratulations! Registration completed successfully.' return HttpResponseRedirect(url) else: form = SignUpForm() return render(request, 'signup.html', mixin({'form': form}))
def signup(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): user = form.save() login(request, user) return redirect('main') else: form = SignUpForm() return render(request, 'qa/signup.html', {'form': form})
def mySignup(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): user = form.save() login(request, user) return HttpResponseRedirect('/') else: form = SignUpForm() return render(request, 'signup.html', {'form': form})
def signup(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): question = form.save() url = '/' return HttpResponseRedirect(url) else: form = SignUpForm() return render(request, 'qa/signup.html', { 'form': form, })
def signup(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): url = reverse('home') user = form.save() auth_login(request, user) return HttpResponseRedirect(url) else: form = SignUpForm() return render(request, 'signup.html', { 'form': form })
def signup(request): if request.method == "POST": form = SignUpForm(request.POST) if form.is_valid(): user = form.save() log_in(request, user) return HttpResponseRedirect("/") else: form = SignUpForm() return render(request, 'qa/signup.html', { 'form': form, 'username': request.user.username })
def signup_view(request): if request.method == "POST": form = SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password') user = authenticate(username=username, password=password) if user is not None: if user.is_authenticated: login(request, user) return HttpResponseRedirect('/') else: form = SignUpForm() return render(request, 'qa/signup.html', { 'form': form, })
def signup(request): if request.method == 'POST': form = SignUpForm(request.POST) url = request.POST.get('continue', '/') if form.is_valid(): form.save() username = request.POST.get('username') password = request.POST.get('password') sessionid = do_login(username, password) response = HttpResponseRedirect(url) response.set_cookie('sessionid', sessionid, httponly=True, expires=timezone.now() + timedelta(days=5)) return response else: form = SignUpForm() return render(request, 'signup.html', { 'form': form, 'user': None, })
def signup(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): user = form.save() if user is not None and user.is_active: user_data = form.cleaned_data user = authenticate(username=user_data['username'], password=user_data['password']) if user: login(request, user) return HttpResponseRedirect(reverse('main')) else: return HttpResponseRedirect('login/') else: form = SignUpForm() return render(request, 'signup.html', {'form': form})
def signup(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): user = form.save() logger.debug('new user created! %s', user) username = form.cleaned_data.get('username') password = form.cleaned_data.get('password') logger.debug('name / password: %s / %s', username, password) # user = authenticate(username=username, password=password) auth_login(request, user) return HttpResponseRedirect(reverse('main_page')) else: form = SignUpForm() return render(request, 'qa/signup.html', {'form': form})
def signup(request): error = '' if request.method == "POST": username = request.POST.get('username') password = request.POST.get('password') url = '/' form = SignUpForm(request.POST) if form.is_valid(): user = form.save() sessionid = do_login(username, password) if sessionid: response = HttpResponseRedirect(url) response.set_cookie('sessionid', sessionid, domain='.', httponly=True, expires = datetime.now()+timedelta(days=5)) return response else: error = u'Неверный логин / пароль' else: form = SignUpForm() return render(request, 'signup.html', {'form': form}) return render(request, 'login.html', {'error': error })
def handle(self, *args, **options): usernames = [] for i in range(30): username, first_name, last_name, email = _namegen.generate() try: form = SignUpForm(data={ "login": username, "email": email, "password": "******", "password_again": "changeme", }) if form.is_valid(): form.save() if first_name != "": form = ProfileForm(data={ "email": email, "first_name": first_name, "last_name": last_name, "about_me": _textgen.generate(2, 5), "avatar": None, }) print(form) print(form.is_valid()) if form.is_valid(): profile = form.save(Profile.objects.profile_str(username)) profile.avatar = randrange(1, 13) profile.save() print(profile.first_name) usernames.append(username) except Exception: pass questions = [] for j in range(len(usernames)): for i in range(randrange(5, 40)): try: shuffle(usernames) username = usernames[0] form = AskForm(data={ "title": _textgen.generate(1, 2, True), "text": _textgen.generate(3, 7), "tags": _textgen.generate_tags(), }) if form.is_valid(): form.profile_user = Profile.objects.profile_str(username=username) question = form.save() question.rating = randrange(-20, 20) question.save() pk = question.pk questions.append(pk) except Exception: pass print(questions) for username in usernames: for i in range(randrange(5, 15)): shuffle(questions) question = Question.objects.get(pk=questions[0]) form = AnswerForm(data={ "text": _textgen.generate(3, 7), "question": question.pk }) if form.is_valid(): form.profile_user = Profile.objects.profile_str(username) form.save()