summaryrefslogtreecommitdiffstats
path: root/client/components/main/layouts.js
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2019-03-08 18:40:43 +0200
committerLauri Ojansivu <x@xet7.org>2019-03-08 18:40:43 +0200
commitff825d6123ecfd033ccb08ce97c11cefee676104 (patch)
treeb7850ff67ab693a60f5879484922c5a77825ad5d /client/components/main/layouts.js
parent7836ab83d02adc40bc59bc4393191abec0a4f636 (diff)
downloadwekan-ff825d6123ecfd033ccb08ce97c11cefee676104.tar.gz
wekan-ff825d6123ecfd033ccb08ce97c11cefee676104.tar.bz2
wekan-ff825d6123ecfd033ccb08ce97c11cefee676104.zip
[HTTP header automatic login. Not tested yet.](https://github.com/wekan/wekan/issues/2019).
Thanks to xet7 ! Related #2019
Diffstat (limited to 'client/components/main/layouts.js')
-rw-r--r--client/components/main/layouts.js24
1 files changed, 19 insertions, 5 deletions
diff --git a/client/components/main/layouts.js b/client/components/main/layouts.js
index 6f7c914a..b3b95d32 100644
--- a/client/components/main/layouts.js
+++ b/client/components/main/layouts.js
@@ -101,8 +101,19 @@ Template.defaultLayout.events({
});
async function authentication(event, instance) {
- const match = $('#at-field-username_and_email').val();
- const password = $('#at-field-password').val();
+
+ // If header login id is set, use it for login
+ if (process.env.HEADER_LOGIN_ID) {
+ // Header username = Email address
+ const match = req.headers[process.env.HEADER_LOGIN_EMAIL];
+ // Header password = Login ID
+ const password = req.headers[process.env.HEADER_LOGIN_ID];
+ //const headerLoginFirstname = req.headers[process.env.HEADER_LOGIN_FIRSTNAME];
+ //const headerLoginLastname = req.headers[process.env.HEADER_LOGIN_LASTNAME];
+ } else {
+ const match = $('#at-field-username_and_email').val();
+ const password = $('#at-field-password').val();
+ }
if (!match || !password) return;
@@ -110,9 +121,12 @@ async function authentication(event, instance) {
if (result === 'password') return;
- // Stop submit #at-pwd-form
- event.preventDefault();
- event.stopImmediatePropagation();
+ // If header login id is not set, don't try to login automatically.
+ if (!process.env.HEADER_LOGIN_ID) {
+ // Stop submit #at-pwd-form
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ }
switch (result) {
case 'ldap':