mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-09 23:20:27 +00:00
commit
198f934138
@ -3,6 +3,8 @@ import sys
|
|||||||
import json
|
import json
|
||||||
import requests
|
import requests
|
||||||
import urlparse
|
import urlparse
|
||||||
|
import hashlib
|
||||||
|
|
||||||
from app import app
|
from app import app
|
||||||
from distutils.version import StrictVersion
|
from distutils.version import StrictVersion
|
||||||
|
|
||||||
@ -145,3 +147,7 @@ def pdns_api_extended_uri(version):
|
|||||||
return "/api/v1"
|
return "/api/v1"
|
||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
def email_to_gravatar_url(email, size=100):
|
||||||
|
hash_string = hashlib.md5(email).hexdigest()
|
||||||
|
return "https://s.gravatar.com/avatar/%s?s=%s" % (hash_string, size)
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
{% if current_user.avatar %}
|
{% if current_user.avatar %}
|
||||||
<img src="{{ url_for('user_avatar', filename=current_user.avatar) }}" class="user-image" alt="User Image"/>
|
<img src="{{ url_for('user_avatar', filename=current_user.avatar) }}" class="user-image" alt="User Image"/>
|
||||||
{% else %}
|
{% else %}
|
||||||
<img src="{{ url_for('static', filename='adminlte2/dist/img/avatar.png') }}" class="user-image" alt="User Image"/>
|
<img src="{{ current_user.email|email_to_gravatar_url(size=80) }}" class="user-image" alt="User Image"/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="hidden-xs">
|
<span class="hidden-xs">
|
||||||
{{ current_user.firstname }}
|
{{ current_user.firstname }}
|
||||||
@ -76,7 +76,7 @@
|
|||||||
{% if current_user.avatar %}
|
{% if current_user.avatar %}
|
||||||
<img src="{{ url_for('user_avatar', filename=current_user.avatar) }}" class="img-circle" alt="User Image"/>
|
<img src="{{ url_for('user_avatar', filename=current_user.avatar) }}" class="img-circle" alt="User Image"/>
|
||||||
{% else %}
|
{% else %}
|
||||||
<img src="{{ url_for('static', filename='adminlte2/dist/img/avatar.png') }}" class="img-circle" alt="User Image"/>
|
<img src="{{ current_user.email|email_to_gravatar_url(size=160) }}" class="img-circle" alt="User Image"/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p>
|
<p>
|
||||||
{{ current_user.firstname }} {{ current_user.lastname }}
|
{{ current_user.firstname }} {{ current_user.lastname }}
|
||||||
@ -111,7 +111,7 @@
|
|||||||
{% if current_user.avatar %}
|
{% if current_user.avatar %}
|
||||||
<img src="{{ url_for('user_avatar', filename=current_user.avatar) }}" class="img-circle" alt="User Image"/>
|
<img src="{{ url_for('user_avatar', filename=current_user.avatar) }}" class="img-circle" alt="User Image"/>
|
||||||
{% else %}
|
{% else %}
|
||||||
<img src="{{ url_for('static', filename='adminlte2/dist/img/avatar.png') }}" class="img-circle" alt="User Image"/>
|
<img src="{{ current_user.email|email_to_gravatar_url(size=100) }}" class="img-circle" alt="User Image"/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-left info">
|
<div class="pull-left info">
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
src="{{ url_for('user_avatar', filename=current_user.avatar) }}"
|
src="{{ url_for('user_avatar', filename=current_user.avatar) }}"
|
||||||
alt="" / style="width: 200px; height: 200px;"> {%
|
alt="" / style="width: 200px; height: 200px;"> {%
|
||||||
else %} <img
|
else %} <img
|
||||||
src="http://www.placehold.it/200x200/EFEFEF/AAAAAA&text=no+image"
|
src="{{ current_user.email|email_to_gravatar_url(size=200) }}"
|
||||||
alt="" /> {% endif %}
|
alt="" /> {% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -22,6 +22,7 @@ from optparse import Values
|
|||||||
jinja2.filters.FILTERS['display_record_name'] = utils.display_record_name
|
jinja2.filters.FILTERS['display_record_name'] = utils.display_record_name
|
||||||
jinja2.filters.FILTERS['display_master_name'] = utils.display_master_name
|
jinja2.filters.FILTERS['display_master_name'] = utils.display_master_name
|
||||||
jinja2.filters.FILTERS['display_second_to_time'] = utils.display_time
|
jinja2.filters.FILTERS['display_second_to_time'] = utils.display_time
|
||||||
|
jinja2.filters.FILTERS['email_to_gravatar_url'] = utils.email_to_gravatar_url
|
||||||
|
|
||||||
# Flag for pdns v4.x.x
|
# Flag for pdns v4.x.x
|
||||||
# TODO: Find another way to do this
|
# TODO: Find another way to do this
|
||||||
@ -68,6 +69,7 @@ def before_request():
|
|||||||
g.user = current_user
|
g.user = current_user
|
||||||
login_manager.anonymous_user = Anonymous
|
login_manager.anonymous_user = Anonymous
|
||||||
|
|
||||||
|
|
||||||
@login_manager.user_loader
|
@login_manager.user_loader
|
||||||
def load_user(id):
|
def load_user(id):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user