Commit 4dc5d7d7 authored by ibuler's avatar ibuler

[Update] 换做lazyproperty

parent 3fc30aa9
...@@ -10,7 +10,6 @@ from django.conf import settings ...@@ -10,7 +10,6 @@ from django.conf import settings
from django.contrib.auth.hashers import make_password from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import AbstractUser from django.contrib.auth.models import AbstractUser
from django.core.cache import cache from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
...@@ -18,7 +17,7 @@ from django.utils import timezone ...@@ -18,7 +17,7 @@ from django.utils import timezone
from django.shortcuts import reverse from django.shortcuts import reverse
from orgs.utils import current_org from orgs.utils import current_org
from common.utils import get_signer, date_expired_default, get_logger from common.utils import get_signer, date_expired_default, get_logger, lazyproperty
from common import fields from common import fields
...@@ -217,7 +216,7 @@ class RoleMixin: ...@@ -217,7 +216,7 @@ class RoleMixin:
from orgs.models import Organization from orgs.models import Organization
return Organization.get_user_admin_or_audit_orgs(self) return Organization.get_user_admin_or_audit_orgs(self)
@property @lazyproperty
def is_org_admin(self): def is_org_admin(self):
if self.is_superuser or self.related_admin_orgs.exists(): if self.is_superuser or self.related_admin_orgs.exists():
return True return True
......
...@@ -173,22 +173,22 @@ ...@@ -173,22 +173,22 @@
</span> </span>
</td> </td>
</tr> </tr>
{% if request.user.can_update_password %} {% if request.user.mfa_enabled %}
<tr class="no-borders"> <tr>
<td>{% trans 'Update password' %}:</td> <td>{% trans 'Update MFA' %}:</td>
<td> <td>
<span class="pull-right"> <span class="pull-right">
<a type="button" class="btn btn-primary btn-xs" style="width: 54px" href="{% url 'users:user-password-update' %}">{% trans 'Update' %}</a> <a type="button" class="btn btn-primary btn-xs" style="width: 54px" href="{% url 'users:user-otp-update' %}">{% trans 'Update' %}</a>
</span> </span>
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
{% if request.user.mfa_enabled %} {% if request.user.can_update_password %}
<tr> <tr class="no-borders">
<td>{% trans 'Update MFA' %}:</td> <td>{% trans 'Update password' %}:</td>
<td> <td>
<span class="pull-right"> <span class="pull-right">
<a type="button" class="btn btn-primary btn-xs" style="width: 54px" href="{% url 'users:user-otp-update' %}">{% trans 'Update' %}</a> <a type="button" class="btn btn-primary btn-xs" style="width: 54px" href="{% url 'users:user-password-update' %}">{% trans 'Update' %}</a>
</span> </span>
</td> </td>
</tr> </tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment