0

3

Hello guys, I want to show a message like, hello windows username for the client and get the client windows username.But with win32 functions i get the server windows username, i want the client username, i tried with javascript and it doesn't work, somehow i need to acces his active directory and i don't know how, the site will be intranet and i tried using a LDAP library and somehow it didn't work, am i doing something wrong? Now the site is on a local server, is in develop.I think the domain will be the same because it's intranet, i am not so advance with the domain also and I saw that LDAP use this a lot. I have read about token login and i researched it and still no clue for me. Just give a lead to follow and i will. Thank you guys a lot for the patience.I have found a similar question but is outdated because they asked 7 years ago.And from what i've seen in javascript you can get the user from the user login, but i don t need a login page. And from session i don't think i am able to give the windows username if it was not inputed, i need the username for errorRespondig.And cookies aren't helping too from what i have seen, i am working on a solution for a 2 or 3 weeks and did not find something useful to me.

Sorry i am new in Django.

win32api.GetUserName() gives the username of the server side.

Thanks in advance

  • 1
    as you maybe saw here : https://stackoverflow.com/a/9518139/8155150, it is not possible because it would be a big security issue. do you want any website you visit to be able to know your windows info that easily ? – Neil Aug 20 '20 at 13:35
  • Does this answer your question? [JavaScript - How to get the name of the current user](https://stackoverflow.com/questions/9518092/javascript-how-to-get-the-name-of-the-current-user) – Neil Aug 20 '20 at 13:36
  • Hello Neil, no it doesn't, and i know what u are saying but for a internal site only in firm, i don't worry about security – Sabou Razvan Aug 20 '20 at 13:53

1 Answers1

0

As Neil just linked in a comment, JavaScript will not be able to determine your Windows user name.

I'd turn your attention to Django, using the documentation provided here

So something along these lines should work:

welcome_user = request.META.get('REMOTE_USER')
Ryan
  • 65
  • 11
  • Hello, @Ryan, this also shows me the server username not client. – Sabou Razvan Aug 20 '20 at 13:54
  • @SabouRazvan https://stackoverflow.com/questions/15024894/how-to-get-username-and-domain-of-windows-logged-in-client-using-python-code/15026574 Check out that link and see if it helps. The top comment recommends checking out SSO for whatever web server you're using. – Ryan Aug 20 '20 at 14:23
  • i don't want for them to login one time and after that they stay logged, i want for them to be logged automatically, when they access the site – Sabou Razvan Aug 21 '20 at 05:40