Skip to content

Commit

Permalink
release v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hgz6536 committed Jun 13, 2016
1 parent 2d94a18 commit 6ec0b51
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion devop/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,14 @@

WSGI_APPLICATION = 'devop.wsgi.application'

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
#EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_HOST = 'smtp.163.com'
#EMAIL_PORT = 25
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'xxx@163.com'
EMAIL_HOST_PASSWORD = 'lxxx'
EMAIL_SUBJECT_PREFIX = u'[管理员]'
DEFAULT_FROM_EMAIL = 'admin <xxx@163.com>'
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases

Expand Down
47 changes: 22 additions & 25 deletions devop/views/permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,34 @@ def PermissionVerify():
def decorator(view_func):
def _wrapped_view(request, *args, **kwargs):
iUser = User.objects.get(username=request.user)
iGroup = Group.objects.filter(user=request.user)
# uid = iUser.id
glst = []
for g in iGroup.all():
glst.append(str(g))
if not iUser.is_superuser:
if 'sa' not in glst:
if not PermissonList.objects.filter(username=iUser.username):
return HttpResponseRedirect(reverse('permissiondenyurl'))
if not iUser.role:
return HttpResponseRedirect(reverse('permissiondenyurl'))
role_permission = RoleList.objects.get(name=iUser.role)
role_permission_list = role_permission.permission.all()
matchUrl = []
for x in role_permission_list:
if request.path == x.url or request.path.rstrip('/') == x.url:
matchUrl.append(x.url)
elif request.path.startswith(x.url):
matchUrl.append(x.url)
else:
role_permisson = PermissonList.objects.filter(username=request.user)
role_permisson = role_permisson.all()
matchurl = []
for x in role_permisson:
if request.path == x.url or request.path.rstrip('/') == x.url:
matchurl.append(x.url)
elif request.path.startswith(x.url):
matchurl.append(x.url)
else:
pass
print('%s---->matchUrl:%s' % (request.user, str(matchurl)))
if len(matchurl) == 0:
return HttpResponseRedirect(reverse('permissiondenyurl'))
else:
pass
pass
user_permission = iUser.permission.all()
for u in user_permission:
if request.path == u.url or request.path.rstrip('/') == u.url:
matchUrl.append(u.url)
elif request.path.startswith(u.url):
matchUrl.append(u.url)
else:
pass
print('%s---------->matchUrl:%s' %(request.user, str(matchUrl)))
if len(matchUrl) == 0:
return HttpResponseRedirect(reverse('permissiondenyurl'))
else:
pass
return view_func(request, *args, **kwargs)

return _wrapped_view

return decorator


Expand Down
7 changes: 6 additions & 1 deletion templates/UserManage/permission.no.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
{% endblock %}

{% block content %}
<p>你没有权限访问,请联系管理员</p>
<p>你没有权限访问,请联系管理员
<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=847644968&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:847644968:52" alt="点击这里给我发消息" title="点击这里给我发消息"/></a>
</p>
<p>
...(。•ˇ‸ˇ•。) ...
</p>
{% endblock %}
6 changes: 3 additions & 3 deletions templates/account/register_done.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% extends "base.html" %}

{% block title %}Welcome{% endblock %}
{% block title %}注册成功{% endblock %}

{% block content %}
<h1>Welcome {{ new_user.first_name }}!</h1>
<p>Your account has been successfully created. Now you can <a href="{% url "login" %}">log in</a>.</p>
<h1>欢迎 {{ new_user.first_name }}!</h1>
<p>账号创建成功. 现在你可以 <a href="{% url "login" %}">登录了</a>.</p>
{% endblock %}
4 changes: 2 additions & 2 deletions templates/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
{% block content %}


<div class="login-form">
<form style="margin: 0 auto; width: 200px;" action="{% url "login" %}" method="post">
<div class="form-group">
<form style="margin: 0 auto; width: 400px;" action="{% url "login" %}" method="post">
{{ form.as_p }}
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}"/>
Expand Down
3 changes: 1 addition & 2 deletions templates/registration/password_change_done.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
{% block title %}密码已经被更改{% endblock %}

{% block content %}
<h1>您的密码已经被更改</h1>
<p>Your password has been successfully changed.</p>
<p>你的密码成功修改</p>
{% endblock %}
5 changes: 2 additions & 3 deletions templates/registration/password_reset_complete.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{% extends "base.html" %}

{% block title %}Password reset{% endblock %}
{% block title %}密码重置完成{% endblock %}

{% block content %}
<h1>Password set</h1>
<p>Your password has been set. You can <a href="{% url "login" %}">log in now</a></p>
<p>密码重置成功. 你可以 <a href="{% url "login" %}">登录</a></p>
{% endblock %}
8 changes: 3 additions & 5 deletions templates/registration/password_reset_confirm.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{% extends "base.html" %}

{% block title %}Reset your password{% endblock %}
{% block title %}重置密码{% endblock %}

{% block content %}
<h1>Reset your password</h1>
{% if validlink %}
<p>Please enter your new password twice:</p>
<form action="." method="post">
{{ form.as_p }}
{% csrf_token %}
<p><input type="submit" value="Change my password" /></p>
<p><input type="submit" value="提交新密码" /></p>
</form>
{% else %}
<p>The password reset link was invalid, possibly because it has already been used. Please request a new password reset.</p>
<p>链接已经失效,可重新申请</p>
{% endif %}
{% endblock %}
10 changes: 6 additions & 4 deletions templates/registration/password_reset_done.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{% extends "base.html" %}

{% block title %}Reset your password{% endblock %}
{% block title %}重置你的密码{% endblock %}

{% block content %}
<h1>Reset your password</h1>
<p>We've emailed you instructions for setting your password.</p>
<p>If you don't receive an email, please make sure you've entered the address you registered with.</p>
<h1>重置你的密码</h1>
<p>已经发送重置密码邮件,注意查收</p>
<p>如果没有收到邮件请确认邮箱地址. 或者联系管理员
<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=847644968&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:847644968:52" alt="点击这里给我发消息" title="点击这里给我发消息"/></a>
</p>
{% endblock %}
4 changes: 2 additions & 2 deletions templates/registration/password_reset_email.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Someone asked for password reset for email {{ email }}. Follow the link below:
你的邮箱地址{{ email }}. 请点击链接重置密码:
{{ protocol }}://{{ domain }}{% url "password_reset_confirm" uidb64=uid token=token %}

Your username, in case you've forgotten: {{ user.get_username }}
你的登录账号是: {{ user.get_username }}

0 comments on commit 6ec0b51

Please sign in to comment.