diff --git a/webroot/AutoSa/AutoSa/urls.py b/webroot/AutoSa/AutoSa/urls.py index d16a55e60..37885677a 100644 --- a/webroot/AutoSa/AutoSa/urls.py +++ b/webroot/AutoSa/AutoSa/urls.py @@ -16,6 +16,7 @@ urlpatterns = patterns('', (r'^logout/$', views.logout), (r'^showUser/$', views.showUser), (r'^addUser/$', views.addUser), + (r'^chgUser/$', views.chgUser), (r'^showAssets/$', views.showAssets), (r'^addAssets/$', views.addAssets), (r'^showPerm/$', views.showPerm), diff --git a/webroot/AutoSa/AutoSa/views.py b/webroot/AutoSa/AutoSa/views.py index afd533791..b2d3a4cb0 100644 --- a/webroot/AutoSa/AutoSa/views.py +++ b/webroot/AutoSa/AutoSa/views.py @@ -580,6 +580,20 @@ def addPerm(request): context_instance=RequestContext(request)) +@admin_required +def chgUser(request): + """修改用户信息""" + error = '' + msg = '' + + if request.method == "GET": + username = request.GET.get('username') + user = User.objects.get(username=username) + return render_to_response('chgUser.html', + {'user': user, 'user_menu': 'active'}, + context_instance=RequestContext(request)) + + @login_required def chgPass(request): """修改登录系统的密码""" @@ -599,7 +613,7 @@ def chgPass(request): error = '两次密码不匹配' if not error: - user.password = password + user.password = md5_crypt(password) user.save() return render_to_response('chgPass.html', {'msg': msg, 'error': error, 'pass_menu': 'active'}, diff --git a/webroot/AutoSa/UserManage/forms.py b/webroot/AutoSa/UserManage/forms.py index affecacf0..9232ac884 100644 --- a/webroot/AutoSa/UserManage/forms.py +++ b/webroot/AutoSa/UserManage/forms.py @@ -10,9 +10,11 @@ class GroupAddForm(forms.Form): class UserAddForm(forms.Form): username = forms.CharField(max_length=30, - widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': '用户名'})) + widget=forms.TextInput( + attrs={'class': 'form-control', 'placeholder': '用户名'})) password = forms.CharField(max_length=30, - widget=forms.PasswordInput(attrs={'class': 'form-control', 'placeholder': '密码'})) + widget=forms.PasswordInput( + attrs={'class': 'form-control', 'placeholder': '密码'})) password_again = forms.CharField(max_length=30, widget=forms.PasswordInput( attrs={'class': 'form-control', 'placeholder': '确认密码'})) diff --git a/webroot/AutoSa/templates/chgUser.html b/webroot/AutoSa/templates/chgUser.html new file mode 100644 index 000000000..5f0ead618 --- /dev/null +++ b/webroot/AutoSa/templates/chgUser.html @@ -0,0 +1,96 @@ +{% extends 'base.html' %} +{% block content %} +
+{% endblock %} \ No newline at end of file diff --git a/webroot/AutoSa/templates/showUser.html b/webroot/AutoSa/templates/showUser.html index 5747cc455..c7ee39344 100644 --- a/webroot/AutoSa/templates/showUser.html +++ b/webroot/AutoSa/templates/showUser.html @@ -18,6 +18,7 @@