Signal-Cartel / EveScoutRescue

Web site and data tools for evescoutrescue.com, maintainer ThriceHappy.
https://evescoutrescue.com/home/
13 stars 10 forks source link

ESRC - page refresh on error changes password unexpectedly #191

Closed Thricehappy closed 6 years ago

Thricehappy commented 6 years ago

From Natan Rigailo: So i got a problem with the site, not a problem actually, i think its a bad behavior, happens as follows: 1-system has no cache, im sowing one 2-i deploy, anchor, put supplies and configure the cache 3-one click copy name one click copy pass 4-cache done, now to fill the data on the site 5-i made a typo on the distance i put 2800 instead of 28000 6- i didnt see and clicked the sow, 7-got the error message about the distance. this is where the bad behavior happens imo, the site refreshes and gives a new password on the one click copy, the old one, that is already the configured on the cache is lost. i got luck and saw that the pass looked different, and had the old one on my ctrl-c, maybe instead of submiting the data and giving the error, i would be better if you could not submit if the distance is wrong

Shwoom commented 6 years ago

New member to SC, keen to get involved in a little bit of dev... Looks like bootstrap, so you can fix this pretty easily by adding bootstrap validation checks, for an integer between 22k and 50k, you'd do something like this:

<input type="text" class="form-control " id="distance" name="distance" type="number" min="22000" max="50000" step="1"/>

Won't work on non-html 5 browsers though, you'd need to do some other js trickery for that, but this would be an easy fix to the modal form to get it fixed most of the time!

Thricehappy commented 6 years ago

Does this bootstrap check require page refresh to display the error? If so, it's that refresh that is causing this error. If not, then this might work!

Shwoom commented 6 years ago

Nah, it should be a javascript check that prevents the form being submitted if the requirements aren't met, i.e. exactly what you need. I haven't actually used bootstrap (but do use foundation a lot and this is how it works), so not 100% sure.

Shwoom commented 6 years ago

You might need to get/initiate a bootstrap validator plugin too... I can take a look but as I don't have any environment set up it might take me some time

Thricehappy commented 6 years ago

If you have time to test it out, let me know. I can add you as a contributor to the project if you want to do an official PR for this.

Shwoom commented 6 years ago

Sure, I'll try and get it going tonight. How do I get a copy of the database, or will it all work with a blank database?

Thricehappy commented 6 years ago

The README has the Create SQL for setting up the tables. it may be a little out of date, so let me know if you have any issues. PM me on our corp Discord to discuss further how you can contribute to the project. Thanks!

Thricehappy commented 6 years ago

Shwoom is working on a client-side fix for this. Server-side will still need to be updated, too. I'll do that once the client-side fix is in, as this ticket will then become normal priority.

adeadparrot commented 6 years ago

That is a great solution, however I don't think it will work for other possible errors, that are not so cut and dried to validate, like the new one raised where the sow and tend planets were the same. However, without getting fancy, you could do this:

change these two elements to call the script:

then add this into page script: Githubissues.
  • Githubissues is a development platform for aggregating issues.