Commit e4924e2e authored by Ryan Herbert's avatar Ryan Herbert Committed by Mathieu Giraud

display login information in top-container

See #2848
parent a3bf5842
Pipeline #188054 passed with stages
in 21 minutes and 47 seconds
......@@ -312,6 +312,8 @@
<div id="fps" style="display: none"> </div>
<div id="header_messages" class="message_container header"></div>
<div id="login-container" class="menu"></div>
<div id='updateIcon' style="display: none; align-items: center; background: transparent; width:1px"></div>
<div id='live-ajax' style="display: flex; align-items: center">
......
......@@ -834,6 +834,7 @@ Database.prototype = {
xhrField: {withCredentials: true},
success: function (result) {
db.call("default/home");
db.clear_login_info();
},
error: function (request, status, error) {
if (status === "timeout") {
......@@ -845,6 +846,23 @@ Database.prototype = {
});
},
extract_login_info: function() {
var login_info = document.getElementById('db_auth_name');
if(login_info != null) {
var container = document.getElementById('login-container');
container.innerHTML = login_info.innerHTML;
var logout = document.createElement('a');
logout.classList.add('button');
logout.text = '(logout)';
logout.onclick = function() {db.logout()};
container.appendChild(logout);
}
},
clear_login_info: function() {
document.getElementById('login-container').innerHTML = '';
},
/*récupére et initialise le browser avec un fichier .data
* args => format json ( parametre attendu > patient_id, config_id)
* filename => patient name used in the patient menu for the previous visited patients
......@@ -1077,6 +1095,7 @@ Database.prototype = {
this.div.style.display = "block";
this.msg.innerHTML = msg;
this.extract_login_info();
this.uploader.display()
},
......
......@@ -51,7 +51,10 @@
{{if not auth.is_impersonating() :}}
{{=auth.user.first_name}} {{=auth.user.last_name}} <a href="#" onclick="db.call('user/edit', {'id': '{{=auth.user_id}}'})"><i class="icon-pencil-2" title="Edit my personal informations"></i></a>
<span id="db_auth_name">
{{=auth.user.first_name}} {{=auth.user.last_name}}
</span>
<a href="#" onclick="db.call('user/edit', {'id': '{{=auth.user_id}}'})"><i class="icon-pencil-2" title="Edit my personal informations"></i></a>
{{pass}}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment