def signup_page(request): if request.method == "POST": form = SignupForm(request.POST) if form.is_valid(): username = form.cleaned_data['username'] password = form.cleaned_data['password'] email = form.cleaned_data['email'] user = User.objects.create_user( username, email, password ) user.save() request.session.flush() user = authenticate(username=username, password=password) if user is not None: if user.is_active: login(request, user) return HttpResponseRedirect("/") return HttpResponseRedirect("/") else: return HttpResponseRedirect("/signup/") if request.method == "GET": form = SignupForm() return render(request, 'signup.html', { 'title': 'Регистрация нового пользователя', 'form': form, 'button-text': 'Регистировать', })
def signup(request): error = '' if request.method == 'POST': form = SignupForm(request.POST) user = None form.is_valid() try: user = form.save() user = authenticate(username=request.POST['username'], password=request.POST['password']) login(request, user) except Exception as e: error = 'not created:\n' + str(e) traceback.print_exc() else: return HttpResponseRedirect('/') else: form = SignupForm() return render(request, 'signup.html', {'error': error, 'form': form})
def user_signup(request): if request.method == 'POST': form = SignupForm(request.POST) if form.is_valid(): user = form.save() if user is not None: login(request, user) return HttpResponseRedirect('/') form = SignupForm() return render(request, 'signup.html', {'form': form})
def signup(request): if request.method == 'POST': form = SignupForm(request.POST) if form.is_valid(): u = form.save() url = '/' authlogin(request, u) 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(): form.clean() user = form.save() 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) if form.is_valid(): user = form.save() auth_login(request, user) return HttpResponseRedirect('/') else: form = SignupForm() return render(request, 'signup_template.html', {'form': form})
def singup(request): if request.method == "POST": form = SignupForm(request.POST) if form.is_valid(): user = form.save() username = request.POST['username'] password = request.POST['password'] user = authenticate(username=username, password=password) login(request, user) return HttpResponseRedirect('/') else: form = SignupForm() return render(request, 'signup.html', {'form': form})
def signup(request, *args, **kwargs): if request.method == "POST": form = SignupForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect("/") else: form = SignupForm() return render(request, 'accounts/signup.html', { 'form': form })
def signup(request): if request.method == 'POST': form = SignupForm(request.POST) if form.is_valid(): user = form.save() request.session.flush() request.session['user'] = user.id return HttpResponseRedirect('/') else: form = SignupForm() return render(request, 'signup_form.html', { 'form': form, })
def signup(request) : if request.method == "POST" : form = SignupForm(request.POST) if form.is_valid() : form.save() #user = form.loginUser() user = authenticate(username=request.POST['username'], password=request.POST['password']) login(request, user) return HttpResponseRedirect("/") else : form = SignupForm() return render(request, 'ask_add.html', { 'form' : form, })
def signup(request): user = request.user if user.is_authenticated(): return HttpResponseRedirect("/") if request.method == "POST": form = SignupForm(request.POST) if form.is_valid(): new_user = form.save(request) return HttpResponseRedirect("/") else: form = SignupForm() return render(request, 'qa/formsignup.html', { 'form': form })
def signup(request): if request.method == 'POST': form = SignupForm(request.POST) p = request.POST if form.is_valid(): User.objects.create_user(username=p.get('username'), email=p.get('email'), password=p.get('password')) user = authenticate(username=p.get('username'), password=p.get('password')) 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(): user = form.save() user = authenticate(username=form.cleaned_data['username'], password=form.cleaned_data['password']) if user is not None: login(request, user) return HttpResponseRedirect('/') 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(): user = form.save() user = authenticate(**form.cleaned_data) if user: login(request, user) return HttpResponseRedirect('/') else: form = SignupForm() return render(request, 'signup.html', { 'form': form, })
def signup(request): error = '' if request.method == 'POST': form = SignupForm(request.POST) if form.is_valid(): user = form.save() login(request, user) response = HttpResponseRedirect('/') # response.set_cookie('sessionid', key, path='/', expires=datetime.now()+timedelta(days=5)) return response else: error = form.errors form = SignupForm() return render(request, 'qa/signup.html', {'form': form, 'error': error})
def signup(request): if request.method == 'POST': form = SignupForm(request.POST) if form.is_valid(): user = form.save() user = authenticate(username=user.username, password=request.POST['password1']) if user is not None and user.is_active: 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) if form.is_valid(): user = form.save(request) if user != None: resp = HttpResponseRedirect('/') #Replace to request.next return resp 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() if user is not None: login(request, user) return HttpResponseRedirect('/') form = SignupForm() return render(request, 'signup.html', { 'form': form, 'user': request.user, 'session': request.session, })
def signup(request): if request.method == 'POST': form = SignupForm(request.POST) if form.is_valid(): user = form.save() username = form.cleaned_data['username'] password = form.raw_passwrd user = authenticate(username=username, password=password) if user is not None: if user.is_active: login(request, user) return HttpResponseRedirect(reverse('index')) else: form = SignupForm() return render(request, 'signup.html', {'form': form})
def signup(request, *args, **kwargs): if request.method == 'POST': form = SignupForm(request.POST) if form.is_valid(): user = form.save() sessionid = create_session(user) url = request.POST.get('continue', '/') response = HttpResponseRedirect(url) response.set_cookie('sessionid', sessionid) return response else: form = SignupForm() return render(request, 'signup.html', { 'form': form, })
def signup(request): if request.method == 'POST': form = SignupForm(request.POST) username = request.POST['username'] password = request.POST['password'] if form.is_valid(): user_new = form.save() user = authenticate(username=username, password=password) if user is not None: login(request, user) return HttpResponseRedirect(reverse('questions_new')) else: form = SignupForm() return render(request, 'registration/signup.html', {"form": form})
def post(self,request): bound_form=SignupForm(request.POST) if bound_form.is_valid(): if bound_form.save(): url=request.POST.get ('continue','/') response=HttpResponseRedirect(url) sessid=CustomUser.objects.do_login(bound_form.cleaned_data['username'],bound_form.cleaned_data['password']) response.set_cookie('sessid', sessid, domain='127.0.0.1',httponly=True, expires=timezone.datetime.now()+timezone.timedelta(days=5) ) return response else: return render (request, 'qa/signup.html',context={'form': bound_form})
def signup(request): if request.method == "POST": form = SignupForm(request.POST) if form.is_valid(): form.save() user = authenticate(username=request.POST.get('username'), password = request.POST.get('password')) #user = form.save() if user is not None and user.is_active: 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) if form.is_valid(): form.save() username = request.POST['username'] password = request.POST['password'] user = auth.authenticate(username=username, password=password) if user is not None and user.is_active: auth.login(request, user) return HttpResponseRedirect('/') return HttpResponseRedirect('/signup.html') else: form = SignupForm() return render(request, 'qa/signup.html', {'form': form})
def signup(request): """Signup view.""" if request.method == 'POST': form = SignupForm(request.POST) if form.is_valid(): user = form.save() auth_user = authenticate(username=user.username, password=form.cleaned_data['password']) login(request, auth_user) return HttpResponseRedirect(reverse('root', kwargs={})) else: form = SignupForm() context = {'form': form} return render(request, 'signup.html', context)
def signup(request): if request.method == 'POST': form = SignupForm(request.POST) if form.is_valid(): form.save() username = request.POST.get('username') password = request.POST.get('password') user = authenticate(username=username, password=password) login(request, user) url = request.POST.get('continue', '/') return HttpResponseRedirect(url) else: form = SignupForm() return render(request, 'signup.html', {'form': form})
def signup_add(request): #logger.debug(request) if request.method == 'POST': #logger.debug('signup_add:' + request.method) form = SignupForm(request.POST) #logger.debug('signup_add POST:' + request.POST['username'] + ',pass='******'password']+ ',email=' + request.POST['email']) if form.is_valid(): #logger.debug('signup_add form.is_valid:') user = form.save() if user is not None: login(request,user) #logger.debug('signup_add login') return HttpResponseRedirect('/') form = SignupForm() return render(request, 'signup.html', {'form': form,})
def user_sign(request): """With a GET request, a form for entering data should be displayed, with a POST request a new user is created, the user created is logged in to the site, the redirect is returned to the main page. The user must receive an authorization cookie """ form = SignupForm(request.POST) if request.method == 'POST' and form.is_valid(): user = form.save() if user is not None: login(request, user) return HttpResponseRedirect('/') else: form = SignupForm() return render(request, 'signup.html', { 'form': form, })
def signup(request): form = SignupForm(request.POST or None) if form.is_valid(): try: user = form.save() except: user = None if user != None: logout(request) login(request, user) return HttpResponseRedirect("/") else: request.session["register_error"] = 1 return render(request, "signup.html", {"form": form})
def signupView(request, *args, **kwargs): if request.method == 'POST': form = SignupForm(request.POST) if form.is_valid(): username = request.POST['username'] password = request.POST['password'] email = request.POST['email'] user = User.objects.create_user(username=username, email=email, password=password) user = authenticate(username=username, password=password) if user is not None: if user.is_active: login(request, user) return HttpResponseRedirect('/') else: form = SignupForm() return render(request, 'login-signup-template.html', {'form': form, 'title': 'Signup', 'signup': True})
def signup(request): if request.method == "POST": form = SignupForm(request.POST) if form.is_valid(): user = form.save() username = form.cleaned_data["username"] password = form.raw_passeord user = authenticate(username=username, password=password) print(type(user)) if user is not None: if user.is_active: login(request, user) return HttpResponseRedirect('/') else: form = SignupForm() return render(request, 'signup.html', {'form': form, 'user': request.user, 'session': request.session, })
def signup(request): if request.method == 'POST': form = SignupForm(request.POST) if form.is_valid(): 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, 'signup.html', { 'form': form, 'user': request.user, 'session': request.session, })
def user_signup(request, *args, **kwargs): if request.method == 'POST': form = SignupForm(request.POST) if form.is_valid(): user = form.save() url = '/' sessionid = do_login(user.username, user.password) response = HttpResponseRedirect(url) response.set_cookie('sessionid', sessionid, domain='127.0.0.1', path='/', httponly=True, expires=datetime.now()+timedelta(days=5) ) return response else: form = SignupForm() return render(request, 'qa/signup.html',{ 'form': form, })
def signup_add(request): # logger.debug(request) if request.method == 'POST': # logger.debug('signup_add:' + request.method) form = SignupForm(request.POST) # logger.debug('signup_add POST:' + request.POST['username'] + ',pass='******'password']+ ',email=' + request.POST['email']) if form.is_valid(): # logger.debug('signup_add form.is_valid:') user = form.save() if user is not None: login(request, user) # logger.debug('signup_add login') return HttpResponseRedirect('/') form = SignupForm() return render(request, 'signup.html', { 'form': form, })
def signup_form(request): #if request.user.is_authenticated(): # return HttpResponseRedirect('/'); if request.method == "POST": form = SignupForm(request.POST) if form.is_valid(): user = form.save() user = authenticate(username=user.username, password=form.cleaned_data['password']) if user is not None: if user.is_active: login(request, user) return HttpResponseRedirect('/') else: form = SignupForm() return render(request, 'signupform.html', { 'form': form, 'path': request.path, })
def user_add(request): if request.method == 'POST': form = SignupForm(request.POST) if form.is_valid(): login = request.POST.get('username') password = request.POST.get('password') user = form.save() url = request.POST.get('continue', '/') sessid = do_login(login, password) if sessid: response = HttpResponseRedirect(url) response.set_cookie('sessionid', sessid) return response else: form = SignupForm() return render(request, 'registration.html', { 'form': form, })
def signup(request): logger.error(request.body) if request.method == 'POST': form = SignupForm(request.POST) username = request.POST.get('username') password = request.POST.get('password') if form.is_valid(): user_new = form.save() user = authenticate(username=username, password=password) if user is not None: login(request, user) # return HttpResponseRedirect(reverse('last_questions_list')) else: form = SignupForm() return render(request, 'registration/signup.html', { "form": form })
def signupHandler(request): if request.POST: form = SignupForm(request.POST) if form.is_valid(): new_user = form.save() username = request.POST['username'] password = request.POST['password'] user = auth.authenticate(username= username, password= password) if user is not None: auth.login(request, user) return HttpResponseRedirect('/') else: form = SignupForm() return render(request, 'signupTemplate.html', { 'signupForm': form, })
def signup_page(request): if request.method == "POST": form = SignupForm(request.POST) if form.is_valid(): user = User.objects.create_user( form.cleaned_data["username"], form.cleaned_data["email"], form.cleaned_data["password"] ) user.save() request.session.flush() request.session['signup']=user.username return HttpResponseRedirect("/") else: return HttpResponseRedirect("/signup/") if request.method == "GET": form = SignupForm() return render(request, 'signup.html', { 'title': 'New reg', 'form': form, 'button-text': 'Reg', })
def signup(request) : if request.method == "POST" : form = SignupForm(request.POST) if form.is_valid() : #print("POST!!!!!!!!!!!!!!!!!!!!!!!!!!!!") #print("username: "******"username") + "!") #print("password: "******"password") + "!") #print("email: " + request.POST.get("email") + "!") form.set_password(request.POST.get("password")) user = form.save() #print("SAVE USER!!!!!!!!!!!!!!!!!!!!!!!") #print("username: "******" !") #print("password: "******" !") #print("email: " + user.email + " !") form.loginUser(request) return HttpResponseRedirect("/") else : form = SignupForm() return render(request, 'ask_add.html', { 'form' : form, })
def signup(request): if request.method == "POST": form = SignupForm(request.POST) if form.is_valid(): # print("POST!!!!!!!!!!!!!!!!!!!!!!!!!!!!") # print("username: "******"username") + "!") # print("password: "******"password") + "!") # print("email: " + request.POST.get("email") + "!") form.set_password(request.POST.get("password")) user = form.save() # print("SAVE USER!!!!!!!!!!!!!!!!!!!!!!!") # print("username: "******" !") # print("password: "******" !") # print("email: " + user.email + " !") form.loginUser(request) return HttpResponseRedirect("/") else: form = SignupForm() return render(request, 'ask_add.html', { 'form': form, })
def vsignup(request): vlogout(request) if request.method=='POST': form=SignupForm(request.POST) if form.is_valid(): user=form.save() username=request.POST.get('username') moi_password=request.POST.get('password') user=authenticate(username=username,password=moi_password) if user is not None: if user.is_active: login(request,user) else: return HttpResponse('User None') else: pass return HttpResponseRedirect('/') else: form=SignupForm() return render(request,'signup.html',{'form': form, 'user': request.user, })
def signup(request, *args, **kwargs): if request.method == "POST": form = SignupForm(request.POST) if form.is_valid() == True: form.save() my_username = form.cleaned_data['username'] my_password = form.cleaned_data['password'] user = authenticate(username=my_username, password=my_password) login(request, user) print('User %s is created!' % my_username) url = '/' return HttpResponseRedirect(url) else: return render(request, 'signup.html', { 'form': form, 'is_user': False, }) else: form = SignupForm() return render(request, 'signup.html', { 'form': form, 'is_user': False, })