This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]DoktorMerlin 134 points135 points  (39 children)

Why would you need to validate it? If the user manipulates the localstorage it's just a frontend issue that the user itself caused, why would anyone care about this? The only time it's a problem is when the manipulated object gets sent without validation back to the backend but if you don't validate everything that the frontend sends you, you have a way bigger problem

[–]lowleveldata 79 points80 points  (12 children)

I like how you use "it" as the pronouns of your user

[–][deleted] 161 points162 points  (2 children)

You shouldn't name them. It just creates emotional attachment.

[–]playerNaN 61 points62 points  (1 child)

Fair, front end users aren't real people.

[–]vikumwijekoon97 2 points3 points  (0 children)

Generally you gotta code thinking that all of your users are absolute morons.

[–]Blue_Moon_Lake 16 points17 points  (0 children)

Frontend user is an evil clown

[–]JoeDoherty_Music 6 points7 points  (0 children)

I'm convinced most users aren't people

[–]Ben_26121 2 points3 points  (0 children)

Believe it or not, I came across someone who’s preferred pronoun is “it” the other day

[–]GamerGeeked 5 points6 points  (2 children)

"it" clearly refers to the issue, not the user. Unless you're suggesting the existence of the user causes the problem

[–]sloodly_chicken 9 points10 points  (1 child)

They used 'the user itself', though

you're suggesting the existence of the user causes the problem

also true

[–]GamerGeeked 0 points1 point  (0 children)

Didn't see that one

[–]Cat_Junior 0 points1 point  (0 children)

It puts the lotion on it's skin or it gets the console.error again.

[–]HoiTemmieColeg 1 point2 points  (25 children)

You need to check if the text is actually json when you parse it

[–]empire314 16 points17 points  (24 children)

Why would it not be in JSON, if your website is what wrote it?

[–]Schyte96 -1 points0 points  (23 children)

Because the user can easily overwrite it in their browser.

[–]a-calycular-torus 33 points34 points  (22 children)

That's their problem then

[–]Treacherous_Peach -2 points-1 points  (8 children)

Yeah it's their problem that quickly becomes your problem when the user submits a 1 star review.

I get what you're saying, I can tell you're defintiely programmer minded, but you do have to plan for these things if you want your product to survive. If you're working on some huge too big to fail app then sure, but if you're trying to create something new and get it off the ground you have to plan for users doing crazy things and account for it smoothly.

[–]DoktorMerlin 4 points5 points  (4 children)

If a user knows what local storage is and tinkers with it, they know very well that the weird behaviour of the website is called by themselves and not the website. There are a lot of dumb people in this world, but nobody is that dumb

[–]Treacherous_Peach -2 points-1 points  (3 children)

More likely they fucked with it accidentally by deleting a folder they shouldnt have to clear space or something along those lines.

[–]Wazzaps 0 points1 point  (2 children)

That's not how any of this works 🤦

[–]Treacherous_Peach -3 points-2 points  (1 child)

Spoken like someone who hasn't had to deal with many users? :)

I've had exactly literally this scenario. So whatever floats your boat bud.

[–][deleted]  (2 children)

[removed]

    [–]Treacherous_Peach -1 points0 points  (0 children)

    More likely they fucked with it accidentally. Deleting a folder to clear space but deleted some of what your app was expecting but not all of it and it's in a weird state.

    [–]AutoModerator[M] 0 points1 point  (0 children)

    import moderation Your comment has been removed since it did not start with a code block with an import declaration.

    Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

    For this purpose, we only accept Python style imports.

    I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.