Can we read the logged in user on the browser?

0
Hi Team,   This is not an issue. We want to know if the scenario is possible by using Mendix platform.   We are using Mendix 10.24.9 version.    We are sending a link to a set of Team to perform certain task. We are creating a deeplink where we are encrypting the email address of the Team and sending to their inbox. When Team accesses the link - We are asking the user to submit the OTP sent to their emails and validating. If the validation is successful - we are allowing the Team to perform their task as anonymous user.   For example :  When Team access the URL - Instead of OTP validation we want to read the logged in account on the browser. When the loggedin email address matches to the encrypted email address on the link. We want to direct them to the task page.   Please help, if this can be possible!   Thanks!
asked
2 answers
0

If I am understanding correctly, you need a Javascript Action that would get the logged in user in the browser.  This javascript action could then be called by a Nanoflow to get the logged in account.  I created a simple javascript action to get the currently logged in user.  Here is the javascript:

// This file was generated by Mendix Studio Pro.
//
// WARNING: Only the following code will be retained when actions are regenerated:
// - the import list
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import "mx-global";
import { Big } from "big.js";

// BEGIN EXTRA CODE
// END EXTRA CODE

/**
 * @returns {Promise.<MxObject>}
 */
export async function GetCurrentUser() {
	// BEGIN USER CODE
	return new Promise((resolve, reject) => {
    mx.data.get({
      guid: mx.session.getUserId(),
      callback: resolve,
      error: reject
    });
  });
	// END USER CODE
}

Hope that helps,

Mike

answered
0

Hi Mike,

 

As a anonymous user when trying to loggin, i want to see the browser logged in user not the Mendix session id. 

 

Please let me know if that is possible!

 

Thanks!

Jhansi Mora

 

 

answered