add userinfo.html forgetpwd an so on,but is so ugly
This commit is contained in:
parent
99d6f6aff3
commit
f48b3ec682
|
@ -46,7 +46,7 @@ INSTALLED_APPS = [
|
|||
'projects',
|
||||
'actions',
|
||||
'operations',
|
||||
# xadmin
|
||||
# xadminxadmin
|
||||
'xadmin',
|
||||
'crispy_forms',
|
||||
'reversion',
|
||||
|
|
|
@ -24,6 +24,11 @@ from projects.views import FileListlView
|
|||
from django.conf.urls.static import static
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
# version模块自动注册需要版本控制的 Model
|
||||
from xadmin.plugins import xversion
|
||||
xversion.register_models()
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('xadmin/', xadmin.site.urls),
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from django import forms
|
||||
from .models import User
|
||||
from captcha.fields import CaptchaField
|
||||
from .models import User
|
||||
|
||||
|
||||
class LoginForm(forms.Form):
|
||||
|
@ -11,3 +12,12 @@ class RegisterForm(forms.Form): # 注册
|
|||
email = forms.EmailField(required=True)
|
||||
password = forms.CharField(required=True, min_length=5)
|
||||
captcha = CaptchaField(error_messages={"invalid": u"验证码错误"})
|
||||
|
||||
class ForgetPwdForm(forms.Form): #忘记密码
|
||||
email = forms.CharField(required=True)
|
||||
captcha = CaptchaField(error_messages={"invalid": u"验证码错误"})
|
||||
|
||||
class UserInfoForm(forms.Form):
|
||||
class Meta:
|
||||
model = User
|
||||
fields = ['nick_name', 'gender', 'birday', 'address', 'mobile']
|
|
@ -15,7 +15,7 @@ Including another URLconf
|
|||
"""
|
||||
|
||||
from django.urls import path
|
||||
from .views import LoginView, LogoutView, RegisterView, UserInfoView, ActiveView
|
||||
from .views import LoginView, LogoutView, RegisterView, UserInfoView, ActiveView,ForgetPwdView
|
||||
|
||||
app_name = "users"
|
||||
urlpatterns = [
|
||||
|
@ -23,5 +23,6 @@ urlpatterns = [
|
|||
path('logout/', LogoutView.as_view(), name='logout'),
|
||||
path('register/',RegisterView.as_view(),name='register'),
|
||||
path('userinfo',UserInfoView.as_view(), name = 'userinfo'),
|
||||
path('forgetpwd',ForgetPwdView.as_view(), name='forgetpwd'),
|
||||
path('active/<str:active_code>', ActiveView.as_view(), name='useractive'),
|
||||
]
|
||||
|
|
|
@ -13,7 +13,7 @@ import requests
|
|||
|
||||
from projects.models import File
|
||||
from .models import User, EmailVerifyRecord
|
||||
from .forms import LoginForm,RegisterForm
|
||||
from .forms import LoginForm,RegisterForm,ForgetPwdForm,UserInfoForm
|
||||
import utils.scanner_project as scanner
|
||||
from pure_pagination import Paginator, EmptyPage, PageNotAnInteger
|
||||
|
||||
|
@ -112,13 +112,13 @@ class UserInfoView(View):
|
|||
user = User.objects.get(id=request.user.id)
|
||||
return render(request, 'users/user_info.html', {'user': user})
|
||||
|
||||
# def post(self, request):
|
||||
# user_info_form = UserInfoForm(request.POST, instance=request.user)
|
||||
# if user_info_form.is_valid():
|
||||
# user_info_form.save()
|
||||
# return HttpResponse('{"status":"success"}', content_type='application/json')
|
||||
# else:
|
||||
# return HttpResponse(json.dumps(user_info_form.errors), content_type='application/json')
|
||||
def post(self, request):
|
||||
user_info_form = UserInfoForm(request.POST, instance=request.user)
|
||||
if user_info_form.is_valid():
|
||||
user_info_form.save()
|
||||
return HttpResponse('{"status":"success"}', content_type='application/json')
|
||||
else:
|
||||
return HttpResponse(json.dumps(user_info_form.errors), content_type='application/json')
|
||||
|
||||
|
||||
# 用户登录
|
||||
|
@ -208,3 +208,21 @@ class LogoutView(View):
|
|||
def get(self, request):
|
||||
logout(request)
|
||||
return HttpResponseRedirect(reverse('index'))
|
||||
|
||||
|
||||
class ForgetPwdView(View):
|
||||
def get(self, request):
|
||||
|
||||
forget_form = ForgetPwdForm()
|
||||
return render(request, 'users/forget_pwd.html',{'forget_form':forget_form})
|
||||
|
||||
def post(self, request):
|
||||
forget_form = ForgetPwdForm(request.POST)
|
||||
if forget_form.is_valid():
|
||||
email = request.POST.get('email', '')
|
||||
from .tasks import send_type_email
|
||||
send_type_email(email, 'forget')
|
||||
|
||||
return render(request, 'users/email_send_success.html')
|
||||
else:
|
||||
return render(request, 'users/', {'forget_form': forget_form})
|
907
nohup.out
907
nohup.out
|
@ -13128,3 +13128,910 @@ Not Found: /http:/www.baidu.com/cache/global/img/gs.gif
|
|||
[15/Jul/2018 00:38:04] "GET http://www.baidu.com/cache/global/img/gs.gif HTTP/1.1" 404 1738
|
||||
[15/Jul/2018 00:51:19] code 400, message Bad request version ('MCTP/1.0')
|
||||
[15/Jul/2018 00:51:19] "REMOTE HI_SRDK_DEV_GetHddInfo MCTP/1.0" 400 -
|
||||
[15/Jul/2018 15:55:50] "GET / HTTP/1.1" 200 24223
|
||||
[15/Jul/2018 15:55:51] "GET /static/vendor/qtip/jquery.qtip.css HTTP/1.1" 304 0
|
||||
[15/Jul/2018 15:55:51] "GET /static/vendor/bootstrap/css/bootstrap.css HTTP/1.1" 304 0
|
||||
[15/Jul/2018 15:55:51] "GET /static/vendor/font-awesome/css/font-awesome.css HTTP/1.1" 304 0
|
||||
[15/Jul/2018 15:55:51] "GET /static/css/common.css HTTP/1.1" 304 0
|
||||
[15/Jul/2018 15:55:51] "GET /static/css/base.css HTTP/1.1" 304 0
|
||||
[15/Jul/2018 15:55:51] "GET /static/css/jstree.css HTTP/1.1" 304 0
|
||||
[15/Jul/2018 15:55:51] "GET /static/css/prettify.css HTTP/1.1" 304 0
|
||||
[15/Jul/2018 15:55:51] "GET /static/vendor/site/css/style.css HTTP/1.1" 304 0
|
||||
[15/Jul/2018 15:55:51] "GET /static/js/run_prettify.js HTTP/1.1" 304 0
|
||||
[15/Jul/2018 15:55:51] "GET /static/js/jstree.js HTTP/1.1" 304 0
|
||||
[15/Jul/2018 15:55:51] "GET /static/js/base.js HTTP/1.1" 304 0
|
||||
[15/Jul/2018 15:55:51] "GET /static/vendor/bootstrap/js/bootstrap.min.js HTTP/1.1" 304 0
|
||||
[15/Jul/2018 15:55:51] "GET /static/vendor/qtip/jquery.qtip.js HTTP/1.1" 304 0
|
||||
[15/Jul/2018 15:55:51] "GET /media/avatar/users/default.png HTTP/1.1" 304 0
|
||||
[15/Jul/2018 15:55:51] "GET /static/image/CodePedia.ico HTTP/1.1" 304 0
|
||||
Not Found: /was5/web/search
|
||||
[15/Jul/2018 16:05:41] "GET /was5/web/search HTTP/1.0" 404 3115
|
||||
[15/Jul/2018 16:52:20] code 400, message Bad request syntax ('\x05\x01\x00')
|
||||
[15/Jul/2018 16:52:20] " |