Link keycloak on profile page
This commit is contained in:
parent
c28fa71b9d
commit
b11c7ecc21
2 changed files with 73 additions and 30 deletions
|
@ -1,5 +1,5 @@
|
|||
{% extends "frontend/base.html" %}
|
||||
{% load i18n %}
|
||||
{% load i18n static %}
|
||||
{% block html_title %}
|
||||
{% block page_title %}
|
||||
{% translate "Profile" %}
|
||||
|
@ -10,32 +10,63 @@
|
|||
<h4 class="card-title">{% translate "Account" %}</h4>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block card_content %}
|
||||
<p>
|
||||
{% blocktranslate trimmed %}
|
||||
You are logged in with your VSHN user account. You will be able to change your password and other settings here in the future.
|
||||
{% endblocktranslate %}
|
||||
</p>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-lg">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{% translate "E-mail" %}</th>
|
||||
<td>{{ request.user.email }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% translate "First name" %}</th>
|
||||
<td>{{ request.user.first_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% translate "Last name" %}</th>
|
||||
<td>{{ request.user.last_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% translate "Company" %}</th>
|
||||
<td>{{ request.user.company }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock card_content %}
|
||||
{% block content %}
|
||||
<section>
|
||||
<div class="row match-height">
|
||||
<div class="col-md-6 col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title">{% translate "Profile" %}</h4>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-lg">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{% translate "E-mail" %}</th>
|
||||
<td>{{ request.user.email }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% translate "First name" %}</th>
|
||||
<td>{{ request.user.first_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% translate "Last name" %}</th>
|
||||
<td>{{ request.user.last_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% translate "Company" %}</th>
|
||||
<td>{{ request.user.company }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title">{% translate "Account" %}</h4>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="card-body">
|
||||
<p>
|
||||
{% blocktranslate trimmed %}
|
||||
You are logged in with your VSHN user account. Change your password and other account data here:
|
||||
{% endblocktranslate %}
|
||||
</p>
|
||||
<a href="{{ account_href }}"
|
||||
class="btn btn-warning btn-lg icon icon-left">
|
||||
<img src="{% static 'img/keycloak.svg' %}" style="height: 30px">
|
||||
<span class="mx-1">{% translate "VSHN Account" %}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock content %}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from django.conf import settings
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
|
||||
|
@ -7,3 +8,14 @@ class IndexView(TemplateView):
|
|||
|
||||
class ProfileView(TemplateView):
|
||||
template_name = "frontend/profile.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
keycloak_server_url = settings.SOCIALACCOUNT_PROVIDERS["openid_connect"][
|
||||
"APPS"
|
||||
][0]["settings"]["server_url"]
|
||||
account_url = keycloak_server_url.replace(
|
||||
"/.well-known/openid-configuration", "/account"
|
||||
)
|
||||
context["account_href"] = account_url
|
||||
return context
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue