add role display in profile

This commit is contained in:
Maryam Bint Ibrahim 2023-05-10 17:41:51 +02:00
parent 5b0062ce0e
commit 45ba633271
2 changed files with 5 additions and 1 deletions

View File

@ -3,6 +3,7 @@
<div class="hero-body">
<div class="container has-text-centered">
<h1>Hello {{name}}</h1>
<h1>Vous occupez le rôle de : {{roles}}</h1>
</div>
</div>
{% endblock %}

View File

@ -18,7 +18,10 @@ def profile():
if not current_user.is_authenticated:
return redirect(url_for('security.login'))
else:
return render_template('profile.html', name=current_user.email)
roles = []
for role in current_user.roles:
roles.append(role.name)
return render_template('profile.html', name=current_user.email, roles=roles)
''' @app.route('/users', endpoint='users', methods=['GET', 'POST'])
@auth_required