Password masking does not work - when I use place holder in formatting (1 Viewer)

Ihk

Member
Local time
Today, 19:36
Joined
Apr 7, 2020
Messages
280
Hi,
I have login form, with control of username and password.
Password control > properties >Data > Input mask = Password
This works if I dont use any kind of placeholder. But If I use formatting (properties >Format>) = @;" Your Password "
In this case, as user press Login button Password is unmasked, similarly if user goes back to username field.
1634934430002.png

But if dont use this place holder "Password or Your Password" then password is masked.
Any suggestions? I know I can use separate label instead of placeholder inside the control, but this I dont want.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:36
Joined
Oct 29, 2018
Messages
21,447
Hi. That's very interesting. I can duplicate the problem. The only solution/workaround I could offer is to use some VBA to remove the Format when the user enters a password, and apply it again when they remove the password.
 

isladogs

MVP / VIP
Local time
Today, 18:36
Joined
Jan 14, 2017
Messages
18,207
I tested this on my own Password Login app and it still masked the entered password even when I added @ to the Format property.
I agree that causes the password to be displayed if the user clicks back to the username field.
However, I see no reason why you need to add @ formatting as described on post #1. What is your reason for doing so?
In my opinion, using any formatting or input mask would just serve to assist someone trying to hack the password control

If you want to try my version, see Password Login - Mendip Data Systems
 
Last edited:

Ihk

Member
Local time
Today, 19:36
Joined
Apr 7, 2020
Messages
280
I tested this on my own Password Login app and it still masked the entered password even when I added @ to the Format property.
I agree that causes the password to be displayed if the user clicks back to the username field.
However, I see no reason why you need to add @ formatting as described on post #1. What is your reason for doing so?
In my opinion, using any formatting or input mask would just serve to assist someone trying to hack the password control

If you want to try my version, see Password Login - Mendip Data Systems
Thank you for sharing this link. I will look into this.
The reason for formatting is, I want to label control with a "place holder" inside the control rather creating a separate label indicating users , this is password field.

Like on any webpage, on any form place holders are placed inside the control, which goes away when user start typing. The same concept I want to try here.
With this problem of unmasking passwords characters appears.
Earlier I was using a separate label, but empty password control then it is fine.
Purpose of this post is to find this new way.
 

isladogs

MVP / VIP
Local time
Today, 18:36
Joined
Jan 14, 2017
Messages
18,207
I don't see any reason to add 'Enter your user name here' or 'Enter Your Password here'.
Its obvious what users need to do. Suggest you scrap the formatting and just use a label
 

CJ_London

Super Moderator
Staff member
Local time
Today, 18:36
Joined
Feb 19, 2013
Messages
16,601
they are mutually exclusive - see this link


in particular
When you've defined an input mask and set the Format property for the same field, the Format property takes precedence when the data is displayed. This means that even if you've saved an input mask, the input mask is ignored when data is formatted and displayed. The data in the underlying table itself isn't changed; the Format property affects only how the data is displayed.

To manage this, you will need code similar to this

Code:
Private Sub Form_Open(Cancel As Integer)
   
    Text0.Format = "@;""Enter Password"""
    Text0.InputMask = ""

End Sub


Private Sub Text0_Enter()

    Text0.Format = ""
    Text0.InputMask = "password"

End Sub


Private Sub Text0_Exit(Cancel As Integer)

    If Nz(Text0, "") = "" Then Form_Open (0)
 
End Sub

 
  • Love
Reactions: Ihk

Ihk

Member
Local time
Today, 19:36
Joined
Apr 7, 2020
Messages
280
they are mutually exclusive - see this link


in particular


To manage this, you will need code similar to this

Code:
Private Sub Form_Open(Cancel As Integer)
  
    Text0.Format = "@;""Enter Password"""
    Text0.InputMask = ""

End Sub


Private Sub Text0_Enter()

    Text0.Format = ""
    Text0.InputMask = "password"

End Sub


Private Sub Text0_Exit(Cancel As Integer)

    If Nz(Text0, "") = "" Then Form_Open (0)

End Sub
Thank you very much @CJ_London , This works perfectly fine. This is what I was looking for.

Just want to mention, it does not work, only if I entered login data and before hitting "login" button, I changed form into design view and opened it again, at this stage passwords are not masked (which were already stored in control before going into design view). Though this is not important, none of user can go into design mood.
Thank you again... Best Regards
 

CJ_London

Super Moderator
Staff member
Local time
Today, 18:36
Joined
Feb 19, 2013
Messages
16,601
the assumption is this is a login form with unbound controls so on first open the password control would be null/zls and users cannot go to design or layout view (wouldn't be much point in masking the password or having a login process would it :)). If the form stays open but hidden or similar or the user reopens the form and fields are autopopulated then you would need to adjust the code for those situations.
 

Ihk

Member
Local time
Today, 19:36
Joined
Apr 7, 2020
Messages
280
the assumption is this is a login form with unbound controls so on first open the password control would be null/zls and users cannot go to design or layout view (wouldn't be much point in masking the password or having a login process would it :)). If the form stays open but hidden or similar or the user reopens the form and fields are autopopulated then you would need to adjust the code for those situations.
Yes exactly, controls on login page are unbound. User must have to type their Username and password.
Once they are successfully logged in, main page or Dashboard will open. This is also right , login form stays open but hidden. In this case as well user can not come back to login page.
On Dashboard User can only either Exit application, or can log off to switch user. On log off, I already set to close the login form 1st and reopen it. This ways fields are not autopopulated. Thank you very much.
 

Users who are viewing this thread

Top Bottom