Exemplo n.º 1
0
def rg_v(request):
    form = SignUpForm()
    if request.method == 'POST':
        form = SignUpForm(request.POST)
        user = form.save()
        user.set_password(user.password)
        user.save()
        return HttpResponseRedirect('/accounts/login')
    return render(request, 'testApp/rgform.html', {'form': form})
Exemplo n.º 2
0
def SignupView(request):
    form = SignUpForm()
    if request.method == "POST":
        form = SignUpForm(request.POST)
        user = form.save()
        user.set_password(user.password)
        user.save()
        # return render(request, 'registration/registration_successful.html', {'form': form})
        return HttpResponseRedirect('/accounts/login')
    return render(request, 'registration/signup.html', {'form': form})
Exemplo n.º 3
0
def signup_view(request):
    form = SignUpForm()
    if request.method == 'POST':
        form = SignUpForm(request.POST)
        #if form.is_valid():
        #    form.save()
        user = form.save()
        user.set_password(user.password)
        user.save()
        #form.save()
        return HttpResponseRedirect('/accounts/login')
    return render(request, 'testApp/signup.html', {'form': form})
Exemplo n.º 4
0
def sign_up_view(request):
    form=SignUpForm()
    if request.method=='POST':
        form=SignUpForm(request.POST)
        """if form.is_valid():  #Method -1 You can also use this to store password in encrypted form
            form.save() """
        #form.save() - Dont use this as this will not store password in encrypted form.
        user=form.save()
        user.set_password(user.password) #Method -2 this will take care of hashing
        user.save()
        return HttpResponseRedirect('/accounts/login')
    return render(request, 'registration/signup.html',{'form':form})
Exemplo n.º 5
0
def register(request):

    if request.method == 'POST':
        form = SignUpForm(request.POST)
        if form.is_valid():
            # create new rows in model table for each public model
            form.save()
            username = form.cleaned_data.get('username')
            raw_password = form.cleaned_data.get('password1')
            user = authenticate(username=username, password=raw_password)
            auth_login(request, user)

            publicModels = Model.objects.filter(public__exact=True).values()
            for model in publicModels:
                modelName = model.get("modelName")
                post = Model(modelName=modelName,
                             userID_id=user.id,
                             public=False)
                post.save()
            return redirect('modelChoice')
    else:
        form = SignUpForm()
    return render(request, 'registration/signup.html', {'form': form})