Propper way to notify user of website?

Hello. I’ve got html page with a form where the user should write a password. I’ve written the function for validating the length of the password and checking if there is a uppercase and a digit. What is the best way to notify the user if his password is not long enough for example? At first, i had a empty html page with {{.}} and I was executing template with message. But it’s really ugly method. Then I tried to write {{.}} to the page itself and then pass script with alert, but it feels strange and I have to use text/html so it’s not escaped. Is there any better way? Thank you very much and sorry for the wall of text :slight_smile:

You could do this a couple of different ways, but a flash message in a cookie may suffice for your needs. Here is an article that discusses using flash messages with cookies: Flash messages with cookies in Go

Thank you very much for the resource. Do I get it right that I can write that message to the cookie and then load the pge and show the message from that cookie?

I’d recommend checking passwords at the client’s end, using Javascript. User interaction is much easier this way, as the password check script can access the page directly to give the user feedback.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.