Skip to content

Commit 65f2ef9

Browse files
committed
update
1 parent cec2c49 commit 65f2ef9

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

diary_app/forms.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,3 @@ class Meta:
3939
class ContactForm(forms.Form):
4040
sender = forms.EmailField()
4141
message = forms.CharField()
42-
43-
44-
class PasswordChangeCustomForm(PasswordChangeForm):
45-
error_css_class = 'subtitle'
46-
error_messages = {'password_incorrect':
47-
"message here"}
48-
49-
old_password = forms.CharField(required=False, label='old_password')
50-
new_password1 = forms.CharField(required=False, label='new_password1')
51-
new_password2 = forms.CharField(required=False, label='new_password2')

diary_app/views.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from django.shortcuts import render, redirect
22
from diary_app.models import Entry, UserData
33
from django.contrib.auth.models import User
4-
from diary_app.forms import EntryForm, UserForm, ProfileUpdateForm, ContactForm, UserUpdateForm, UserUpdateForm, NewUserForm, PasswordChangeCustomForm
5-
#from django.contrib.auth.forms import PasswordChangeForm
4+
from diary_app.forms import EntryForm, UserForm, ProfileUpdateForm, ContactForm, UserUpdateForm, UserUpdateForm, NewUserForm
5+
from django.contrib.auth.forms import PasswordChangeForm
66
from django.http import HttpResponse, HttpResponseRedirect
77
from django.shortcuts import get_object_or_404
88
from django.contrib.auth import authenticate, login, logout
@@ -179,7 +179,7 @@ def SocialSignUp(request):
179179
form = NewUserForm(request.POST, instance=new_user)
180180
if form.is_valid():
181181
form.save()
182-
return redirect('home')
182+
return redirect(self.request.GET.get('next'))
183183
else:
184184
form = NewUserForm()
185185
return render(request, 'users/social-signup.html', {'form': form, 'new_user': new_user})
@@ -217,7 +217,7 @@ def Profile(request):
217217
if request.method == 'POST':
218218
uform = UserUpdateForm(request.POST, instance=current_user)
219219
puform = ProfileUpdateForm(request.POST, instance=get_bio)
220-
pcform = PasswordChangeCustomForm(request.user, request.POST)
220+
pcform = PasswordChangeForm(request.user, request.POST)
221221

222222
if uform.is_valid() and puform.is_valid() and pcform.is_valid():
223223
puform.save()
@@ -228,6 +228,6 @@ def Profile(request):
228228
else:
229229
uform = UserUpdateForm()
230230
puform = ProfileUpdateForm()
231-
pcform = PasswordChangeCustomForm(request.user)
231+
pcform = PasswordChangeForm(request.user)
232232

233233
return render(request, "users/profile.html", {'uform': uform, 'puform': puform, 'pcform': pcform, 'current_user': current_user, 'get_bio': get_bio})

diary_proj/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
'social_core.pipeline.social_auth.associate_by_email',
187187
)
188188

189-
SOCIAL_AUTH_NEW_USER_REDIRECT_URL = '/social-signup/'
189+
SOCIAL_AUTH_NEW_USER_REDIRECT_URL = '/social-signup/?next=/'
190190

191191
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
192192
EMAIL_HOST = 'smtp.gmail.com'

0 commit comments

Comments
 (0)