Page 1 of 1

Post-Auth Email Script - get the user's platform

Posted: Thu Jun 01, 2023 2:01 pm
by Epigraphe
Good day.
I update the script for sending a message to the mail when a user connects.
I took the script from viewtopic.php?t=15927 as a basis, but redid it for python 3.
Everything is working as expected, but there was one issue: I can't get the user's platform.
What does the request look like?
I tried to do this

Code: Select all

 if attributes.get('auth_parms'):
            useros = attributes('IV_PLAT')
        else:
            useros = 'Impossible to Determine'
and that

Code: Select all

 if attributes.get('IV_PLAT'):
            useros = attributes('IV_PLAT')
        else:
            useros = 'Impossible to Determine'
and that

Code: Select all

 if attributes.client_info get('auth_parms'):
            useros = attributes.client_info.get('IV_PLAT')
        else:
            useros = 'Impossible to Determine'
with combinations, but all without success.
Thank you.

Re: Post-Auth Email Script - get the user's platform

Posted: Fri Jun 02, 2023 7:27 am
by tieumyxinhdep
To retrieve the user's platform in your post-auth email script, you can try accessing the appropriate attribute based on the structure of your attributes object. Here's an example that demonstrates how to obtain the user's platform:

python
if 'auth_parms' in attributes:
useros = attributes['auth_parms'].get('IV_PLAT')
else:
useros = 'Impossible to Determine'


In this example, we first check if the 'auth_parms' attribute exists in the attributes object. If it does, we access the 'IV_PLAT' attribute within 'auth_parms' to retrieve the user's platform. Otherwise, we set the platform as 'Impossible to Determine'.

Make sure that the attribute names and object structure match your specific implementation. If the above code doesn't work, it's possible that the attribute containing the user's platform has a different name or is nested differently in the attributes object. In that case, you may need to inspect the structure of the attributes object to identify the correct attribute path for retrieving the user's platform information.

If you provide more details about the structure of the attributes object or the available attributes, I can assist you further in accessing the user's platform correctly.

Re: Post-Auth Email Script - get the user's platform

Posted: Fri Jun 02, 2023 10:33 am
by Epigraphe
Thank you for the example and explanation.
I tried - everything works as it should.
Thank you for explaining exactly how to make a request.
Now I can add the rest of the additional information to the letter.