forked from Github-Mirrors/canaille
Default configuration and test client use user avatars
This commit is contained in:
parent
951fce2725
commit
f4c04d9666
6 changed files with 79 additions and 57 deletions
|
@ -519,7 +519,7 @@ def reset(uid, hash):
|
|||
|
||||
@bp.route("/profile/<uid>/<field>")
|
||||
def photo(uid, field):
|
||||
if field != "jpegPhoto":
|
||||
if field.lower() != "jpegphoto":
|
||||
abort(404)
|
||||
|
||||
user = User.get(uid)
|
||||
|
|
|
@ -156,6 +156,7 @@ FAMILY_NAME = "{{ user.sn[0] }}"
|
|||
PREFERRED_USERNAME = "{{ user.displayName[0] }}"
|
||||
LOCALE = "{{ user.preferredLanguage[0] }}"
|
||||
ADDRESS = "{{ user.postalAddress[0] }}"
|
||||
PICTURE = "{% if user.jpegPhoto %}{{ url_for('account.photo', uid=user.uid[0], field='jpegPhoto', _external=True) }}{% endif %}"
|
||||
|
||||
# The SMTP server options. If not set, mail related features such as
|
||||
# user invitations, and password reset emails, will be disabled.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
@ -17,9 +17,9 @@
|
|||
<script src="/static/js/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body>
|
||||
<nav class="ui stackable labeled icon menu container">
|
||||
<div class="header item">
|
||||
<a href="/" class="logo">
|
||||
|
@ -29,12 +29,12 @@
|
|||
{% if user %}
|
||||
<a class="item" href="{{ url_for('logout') }}">
|
||||
<i class="sign out alternate icon"></i>
|
||||
Log out
|
||||
Sign out
|
||||
</a>
|
||||
{% else %}
|
||||
<a class="item" href="{{ url_for('login') }}">
|
||||
<i class="sign in alternate icon"></i>
|
||||
Log in
|
||||
Sign in
|
||||
</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
|
@ -50,22 +50,37 @@
|
|||
|
||||
<div class="ui segment">
|
||||
<h2 class="ui header">{{ name }}</h2>
|
||||
<div>
|
||||
{% if user %}
|
||||
<p>Welcome {{ user.name }}</p>
|
||||
{% if user.groups %}
|
||||
<p>You're a member of the following groups: {{ user.groups }}</p>
|
||||
<div class="ui centered card">
|
||||
{% if user.picture %}
|
||||
<div class="image">
|
||||
<img src="{{ user.picture }}" alt="Avatar">
|
||||
</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
Welcome, please <a href="{{ url_for('login') }}">log-in</a>.
|
||||
<div class="content">
|
||||
<span class="header">{{ user.name }}</span>
|
||||
<div class="meta">
|
||||
{{ user.sub }}
|
||||
</div>
|
||||
{% if user.groups %}
|
||||
<div class="extra content">
|
||||
<i class="user users icon"></i>
|
||||
{% for group in user.groups %}
|
||||
<span class="label">{{ group }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<a class="ui primary button" href="{{ url_for('login') }}">Sign in</a>.
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/static/jquery/jquery.min.js"></script>
|
||||
<script src="/static/fomanticui/semantic.min.js"></script>
|
||||
<script src="/static/js/base.js"></script>
|
||||
{% block script %}{% endblock %}
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -162,6 +162,7 @@ FAMILY_NAME = "{{ user.sn[0] }}"
|
|||
PREFERRED_USERNAME = "{{ user.displayName[0] }}"
|
||||
LOCALE = "{{ user.preferredLanguage[0] }}"
|
||||
ADDRESS = "{{ user.postalAddress[0] }}"
|
||||
PICTURE = "{% if user.jpegPhoto %}{{ url_for('account.photo', uid=user.uid[0], field='jpegPhoto', _external=True) }}{% endif %}"
|
||||
|
||||
# The SMTP server options. If not set, mail related features such as
|
||||
# user invitations, and password reset emails, will be disabled.
|
||||
|
|
|
@ -212,6 +212,10 @@ Attributes are rendered using jinja2, and can use a ``user`` variable.
|
|||
:ADDRESS:
|
||||
*Optional.* Defaults to ``{{ user.postalAddress[0] }}``
|
||||
|
||||
:PICTURE:
|
||||
*Optional.* Defaults to ``{% if user.jpegPhoto %}{{ url_for('account.photo', uid=user.uid[0], field='jpegPhoto', _external=True) }}{% endif %}``
|
||||
|
||||
|
||||
SMTP
|
||||
----
|
||||
Canaille needs you to configure a SMTP server to send some mails, including the *I forgot my password* and the *invitation* mails.
|
||||
|
|
|
@ -187,6 +187,7 @@ def configuration(slapd_server, smtpd, keypair_path):
|
|||
"FAMILY_NAME": "{{ user.sn[0] }}",
|
||||
"PREFERRED_USERNAME": "{{ user.displayName[0] }}",
|
||||
"LOCALE": "{{ user.preferredLanguage[0] }}",
|
||||
"PICTURE": "{% if user.jpegPhoto %}{{ url_for('account.photo', uid=user.uid[0], field='jpegPhoto', _external=True) }}{% endif %}",
|
||||
},
|
||||
},
|
||||
"SMTP": {
|
||||
|
|
Loading…
Reference in a new issue