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>")
|
@bp.route("/profile/<uid>/<field>")
|
||||||
def photo(uid, field):
|
def photo(uid, field):
|
||||||
if field != "jpegPhoto":
|
if field.lower() != "jpegphoto":
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
user = User.get(uid)
|
user = User.get(uid)
|
||||||
|
|
|
@ -156,6 +156,7 @@ FAMILY_NAME = "{{ user.sn[0] }}"
|
||||||
PREFERRED_USERNAME = "{{ user.displayName[0] }}"
|
PREFERRED_USERNAME = "{{ user.displayName[0] }}"
|
||||||
LOCALE = "{{ user.preferredLanguage[0] }}"
|
LOCALE = "{{ user.preferredLanguage[0] }}"
|
||||||
ADDRESS = "{{ user.postalAddress[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
|
# The SMTP server options. If not set, mail related features such as
|
||||||
# user invitations, and password reset emails, will be disabled.
|
# user invitations, and password reset emails, will be disabled.
|
||||||
|
|
|
@ -1,71 +1,86 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="fr">
|
<html lang="fr">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
|
||||||
<title>Canaille test client</title>
|
<title>Canaille test client</title>
|
||||||
|
|
||||||
<link href="/static/fomanticui/semantic.min.css" rel="stylesheet">
|
<link href="/static/fomanticui/semantic.min.css" rel="stylesheet">
|
||||||
<link href="/static/css/base.css" rel="stylesheet">
|
<link href="/static/css/base.css" rel="stylesheet">
|
||||||
{% if logo_url %}<link rel="icon" href="{{ favicon_url }}">{% endif %}
|
{% if logo_url %}<link rel="icon" href="{{ favicon_url }}">{% endif %}
|
||||||
{% block style %}{% endblock %}
|
{% block style %}{% endblock %}
|
||||||
|
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script>window.html5 || document.write('<script src="/static/html5shiv/html5shiv.min.js"><\/script>')</script>
|
<script>window.html5 || document.write('<script src="/static/html5shiv/html5shiv.min.js"><\/script>')</script>
|
||||||
<script src="/static/js/respond.min.js"></script>
|
<script src="/static/js/respond.min.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<nav class="ui stackable labeled icon menu container">
|
<nav class="ui stackable labeled icon menu container">
|
||||||
<div class="header item">
|
<div class="header item">
|
||||||
<a href="/" class="logo">
|
<a href="/" class="logo">
|
||||||
<img class="ui image" src="/static/img/canaille-head.png" alt="Canaille client" />
|
<img class="ui image" src="/static/img/canaille-head.png" alt="Canaille client" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
|
||||||
{% if user %}
|
|
||||||
<a class="item" href="{{ url_for('logout') }}">
|
|
||||||
<i class="sign out alternate icon"></i>
|
|
||||||
Log out
|
|
||||||
</a>
|
|
||||||
{% else %}
|
|
||||||
<a class="item" href="{{ url_for('login') }}">
|
|
||||||
<i class="sign in alternate icon"></i>
|
|
||||||
Log in
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="ui container">
|
|
||||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
|
||||||
{% for category, message in messages %}
|
|
||||||
<div class="ui attached message {{ category }}">
|
|
||||||
{{ message }}
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
|
||||||
{% endwith %}
|
|
||||||
|
|
||||||
<div class="ui segment">
|
|
||||||
<h2 class="ui header">{{ name }}</h2>
|
|
||||||
<div>
|
|
||||||
{% if user %}
|
{% if user %}
|
||||||
<p>Welcome {{ user.name }}</p>
|
<a class="item" href="{{ url_for('logout') }}">
|
||||||
{% if user.groups %}
|
<i class="sign out alternate icon"></i>
|
||||||
<p>You're a member of the following groups: {{ user.groups }}</p>
|
Sign out
|
||||||
{% endif %}
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
Welcome, please <a href="{{ url_for('login') }}">log-in</a>.
|
<a class="item" href="{{ url_for('login') }}">
|
||||||
|
<i class="sign in alternate icon"></i>
|
||||||
|
Sign in
|
||||||
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="ui container">
|
||||||
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||||
|
{% for category, message in messages %}
|
||||||
|
<div class="ui attached message {{ category }}">
|
||||||
|
{{ message }}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endwith %}
|
||||||
|
|
||||||
|
<div class="ui segment">
|
||||||
|
<h2 class="ui header">{{ name }}</h2>
|
||||||
|
{% if user %}
|
||||||
|
<div class="ui centered card">
|
||||||
|
{% if user.picture %}
|
||||||
|
<div class="image">
|
||||||
|
<img src="{{ user.picture }}" alt="Avatar">
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="/static/jquery/jquery.min.js"></script>
|
<script src="/static/jquery/jquery.min.js"></script>
|
||||||
<script src="/static/fomanticui/semantic.min.js"></script>
|
<script src="/static/fomanticui/semantic.min.js"></script>
|
||||||
<script src="/static/js/base.js"></script>
|
<script src="/static/js/base.js"></script>
|
||||||
{% block script %}{% endblock %}
|
{% block script %}{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -162,6 +162,7 @@ FAMILY_NAME = "{{ user.sn[0] }}"
|
||||||
PREFERRED_USERNAME = "{{ user.displayName[0] }}"
|
PREFERRED_USERNAME = "{{ user.displayName[0] }}"
|
||||||
LOCALE = "{{ user.preferredLanguage[0] }}"
|
LOCALE = "{{ user.preferredLanguage[0] }}"
|
||||||
ADDRESS = "{{ user.postalAddress[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
|
# The SMTP server options. If not set, mail related features such as
|
||||||
# user invitations, and password reset emails, will be disabled.
|
# 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:
|
:ADDRESS:
|
||||||
*Optional.* Defaults to ``{{ user.postalAddress[0] }}``
|
*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
|
SMTP
|
||||||
----
|
----
|
||||||
Canaille needs you to configure a SMTP server to send some mails, including the *I forgot my password* and the *invitation* mails.
|
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] }}",
|
"FAMILY_NAME": "{{ user.sn[0] }}",
|
||||||
"PREFERRED_USERNAME": "{{ user.displayName[0] }}",
|
"PREFERRED_USERNAME": "{{ user.displayName[0] }}",
|
||||||
"LOCALE": "{{ user.preferredLanguage[0] }}",
|
"LOCALE": "{{ user.preferredLanguage[0] }}",
|
||||||
|
"PICTURE": "{% if user.jpegPhoto %}{{ url_for('account.photo', uid=user.uid[0], field='jpegPhoto', _external=True) }}{% endif %}",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"SMTP": {
|
"SMTP": {
|
||||||
|
|
Loading…
Reference in a new issue