want to call change password from in codeunit 1

tanmaykothari
tanmaykothari Member Posts: 73
Dear All,

we want to call change password from(System Form) in on company open
codeunit

Tolls -> Security -> Password

Is this possible? how?
Please help..


Thanks in advance... ](*,)

Comments

  • ppavuk
    ppavuk Member Posts: 334
    I don't think it is possible.
  • Luc_VanDyck
    Luc_VanDyck Member, Moderator, Administrator Posts: 3,633
    You could try using SendKeys, to send the keystrokes Alt-T, S & P. But it's a dirty hack to get the job done.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • ppavuk
    ppavuk Member Posts: 334
    I would not rely on sendkeys for this. But, the question is what is purpose of this requirement? It could be easier to implement windows logins and manage password change policy within domain.
  • tanmaykothari
    tanmaykothari Member Posts: 73
    You could try using SendKeys, to send the keystrokes Alt-T, S & P. But it's a dirty hack to get the job done.

    Thanx =D>....

    It's working using SendKeys

    below is the code for the same

    IF ISCLEAR(WshShell) THEN
    CREATE(WshShell);
    WaitForKeys := TRUE;
    WshShell.SendKeys('%{T}{s}{p}',WaitForKeys);

    Steps
    Declare variable WshShell dtatype is Automation and subtype is 'Windows Script Host Object Model'.WshShell

    % for ALT
    {T} to open Toll
    {s} to open security
    {P} to open password
  • ppavuk
    ppavuk Member Posts: 334
    Ok, you did this. But what stopping user just to escape from this form? What requirement you truing to implement with this?
  • tanmaykothari
    tanmaykothari Member Posts: 73
    ppavuk wrote:
    Ok, you did this. But what stopping user just to escape from this form? What requirement you truing to implement with this?


    can you please tell me how to close navision if user press escape from this form
    or can i use sendkey function two times 1) for trigger change password form
    2)and another is if user press escape button
  • ppavuk
    ppavuk Member Posts: 334
    It is just a wrong way to sort out security. Use active directory - it is much more flexible.
  • vaprog
    vaprog Member Posts: 1,163
    I agree with ppavuk, but since you (or your superior/customer) insist...

    You might check the Password field in the User table for change. If it did not change, no new password was entered. This way you can even check that the password was not set to blank.
  • ppavuk
    ppavuk Member Posts: 334
    Our job is to decrease entropy, so I think we must use right tools and technologies to achieve customer's requirements. If you boss forcing you to use wrong approach - it make sense at least to try to offer better solution.

    This one is dirty hack and big mess. At some point someone else will support this stuff and blame this code authors. The NAV security can do what it can do, if you need more - use active directory. I am sure its better to spend time to implement right solution.