Unlock account with wntUserSetDat
Keywords: Unlock account with wntUserSetDat
Question:
I can disable and lock a user's account with wntUserSetDat("","joeuser","flags",18) but, is it possible to ENable and / or UNlock an account with this function?Answer:
Yes, you can. And, the code fragment that you posted is dangerous. You are overwriting the flags value rather than reading the current value, modifying it and then writing the modified value back to the user account.Do the following to modify it safely:
flags = wntUserGetDat("","joeuser","flags",0) ; Do one of the four following things by ; uncommenting it: ;flags = flags & (~2) ; turn off account disable ;flags = flags & (~16) ; turn off account lockout ;flags = flags | 2 ; turn on account disable ;flags = flags | 16 ; turn on account lockout wntUserSetDat("","joeuser","flags",flags,0)
Article ID: W15202