Show dynamic_email to user

Hello, during email token enrollment I’d like to show the “dynamic_email” to user, so he could check if
update it or not before enrolling the token
Is there any way to get this information ? I’ve tried {{ }} {{ }} and a lot of other combinations, but without success.
And, does a list of all those variables exist ?
Thank you

I understand you want to display this in the webui?

Try using {{ user }} and {{ loggedInUser }}. This way you will see the complete object and you can take a look at the attributes.

But I think in the user context the email address is not available.

Why would a user not know his email? So if you want to the user to be able to set the email? Why use the dynamic email which is ment for the admin to devide, which email address is used?

Hello, thank you for the answer.
I’d like to display the user email to the user because the email token will be sent to his secondary email and
maybe he doesn’t remember what it is; privacyidea gets that email from ldap resolver. The email token won’t be sent to his primary email because he needs the token to access it.
So I would like to print during token wizard or normal email token enrollment something like “I’ll send the
token to your email address: xxx@yyy.zzz”
I’ve already tried using {{ user }} and {{ loggedInUser }}, but there’s no email in those object; I’ve read
some js and html sources under /opt/privacyidea/lib/python3.9/site-packages/privacyidea/static, and I
suppose I should use “UserFactory” under the appropriate token controller, to create an user email object for the page of token enrollment, is it right ? I don’t know angular, just started studying it
Thank you

Hello, I think I’ve found a solution, I post if anyone was interested: I’ve added the following code to the controller “tokenController”:

    $scope.getUserDetails = function () {
        UserFactory.getUserDetails({}, function (data) {
            $scope.User = data.result.value[0];

just before the lines:
// listen to the reload broadcast
$scope.$on(“piReload”, function() {

and added UserFactory in
myApp.controller("tokenController", ['TokenFactory', 'ConfigFactory', '$scope', '$location', 'AuthFactory', 'instanceUrl', '$rootScope', function (TokenFactory, ConfigFactory, $scope, $location, AuthFactory, instanceUrl, $rootScope) {
so it became:
myApp.controller("tokenController", ['TokenFactory', 'ConfigFactory', '$scope', '$location', 'AuthFactory', 'instanceUrl', '$rootScope','UserFactory', function (TokenFactory, ConfigFactory, $scope, $location, AuthFactory, instanceUrl, $rootScope, UserFactory) {

Now I have the {{ User }}' object available on token enrollment page, and email is {{ }}`

I don’t know if it is the best way to achieve this, but it seems to work.


1 Like

Sounds sensible to me.
Would you mind opening an issue and a pull request?