Reaster0 / ft_transcendence

la transcendaaance
0 stars 2 forks source link

User setting edit #108

Closed LesChats closed 2 years ago

LesChats commented 2 years ago

the editing of users setting is broken....

when changing nickname where sending bad request at each new character entry. that eventually lead the all page to brake (here the avatar as suddenly disappear)

Screen Shot 2022-06-22 at 1 51 29 PM
Ala-Na commented 2 years ago

I think it's "normal" for the avatar to disappear. You can see the giant cloud icon as a button "upload your avatar". If you return to main account page, the new avatar selected should appears. But yeah, the bad request stuff is more worrying, as it pops each time we go to the user page.

Reaster0 commented 2 years ago

yeah the avatar dosen't disappear i don't show it at all, and i don't send bed request i just send a request to change the nickname each time the user change the nickname, it would be the same thing if i put a button "send new username" if the backend send no as a response (400) it's just a reponse from the backend when the nickname is invalid, if you want you can change the code sended when there is an invalid nickname and it would not show as red but it's not an issue really (and yes i send it once at the start of the page i can't really change it but it's not a problem)

LesChats commented 2 years ago

I thing were not suppose to get red error message popping up at any time of the process. Still the page is doing weird stuff will Im adding characters to the field. (first append when you add 5 character the page "format" change.

The logic of sending a backend + dataBase request to update de name at each input seems doubtful...

thx for the explanation about the "bug" logic, sorry for my misinterpretation 😅

Reaster0 commented 2 years ago

there is "red error message" (403 400 and 404) that is being sended y the backend when you can't do a thing (like trying to access a route without being logged and things like that, even, when you're not connected there is a "red error message" it's just the response of the request and mozilla show it has red, it's not an error by any mean

LesChats commented 2 years ago

plus everything is allowed... empty nickName, dangerous non alphaNum ones, superUperLong.... I will add some check on the backend

Ala-Na commented 2 years ago

Ah yeah, good idea ! Forgot to implement them after we decided of nickname actual implementation. Something other than alphanum should not work though typeorm would send an error according to entities set up, but previous check would be better.

LesChats commented 2 years ago
Screen Shot 2022-06-22 at 7 26 55 PM
Ala-Na commented 2 years ago

Well, I guess class-validator doesn't work as I hoped for entities

LesChats commented 2 years ago

im correcting everything. no more red light

Reaster0 commented 2 years ago

so you've just send another code as response?

LesChats commented 2 years ago

no preventing to try update if the newNickname is not different from the old one. everything is ok know <3