NATION

PASSWORD

[bug] login pages reorder url parameters on redirect

Bug reports, general help, ideas for improvements, and questions about how things are meant to work.
User avatar
SherpDaWerp
Diplomat
 
Posts: 893
Founded: Mar 02, 2016
Civil Rights Lovefest

[bug] login pages reorder url parameters on redirect

Postby SherpDaWerp » Wed Sep 23, 2020 11:06 pm

When specifying /asnation=<foo> as a URL parameter, if you aren't logged in as <foo> then NS will give you a login prompt. Once you've logged in, NS directs you back to the original page you wanted to go to. However, when it does so, it re-orders all the other URL parameters (parameters being stuff like /nation=<foo>/dilemma=161/page=enact_dilemma).

When I have a userscript that matches based on a specific order of parameters, this causes problems. The original link I open is always of the same format: https://www.nationstates.net/container=*/page=enact_dilemma/choice-*=1/dilemma=*/template-overall=none/nation=*/asnation=*/t=*
I create these links with a Python script that simply formats values in, so the format doesn't change.

So far, I have encountered redirected URLs of the following 2 alternative formats:
https://www.nationstates.net/page=enact_dilemma/choice-*=1/container=*/asnation=*/template-overall=none/dilemma=*/t=*
https://www.nationstates.net/page=enact_dilemma/container=*/choice-*=1/asnation=*/template-overall=none/dilemma=*/t=*

More specifically, the following two exact urls (besides the deliberately removed token parameter) redirected after login to each of the above two formats, respectively.

https://www.nationstates.net/container=Imperial_Regiment_XIV/page=enact_dilemma/choice-3=1/dilemma=644/template-overall=none/nation=Imperial_Regiment_XIV/asnation=Imperial_Regiment_XIV/t=<censored>
https://www.nationstates.net/container=Imperial_Regiment_XV/page=enact_dilemma/choice-2=1/dilemma=161/template-overall=none/nation=Imperial_Regiment_XV/asnation=Imperial_Regiment_XV/t=<censored>

I know NS can deal with URL parameters in any order, but unfortunately, userscript matching patterns don't have that luxury. What makes these two URLs different such that they redirect to different pages post-login?
Last edited by SherpDaWerp on Wed Sep 23, 2020 11:42 pm, edited 2 times in total.

User avatar
[violet]
Site Admin
 
Posts: 14646
Founded: Antiquity

Postby [violet] » Thu Sep 24, 2020 8:38 pm

This might be consistent now.

By the way, I've been trying to track down a weird /asnation= bug forever, where sometimes we seem to get nations loaded as strings instead of objects. Have you encountered any strange page errors when using /asnation?

User avatar
SherpDaWerp
Diplomat
 
Posts: 893
Founded: Mar 02, 2016
Civil Rights Lovefest

Postby SherpDaWerp » Thu Sep 24, 2020 8:56 pm

[violet] wrote:This might be consistent now.

By the way, I've been trying to track down a weird /asnation= bug forever, where sometimes we seem to get nations loaded as strings instead of objects. Have you encountered any strange page errors when using /asnation?

Thanks, I wasn't sure if this would be a "yes fix" or "no deal with it" type bug, so that's a welcome outcome.

I haven't seen any weird errors so far, but I'll keep my eye out.

The errors, would they redirect to a new page (like this) or would they appear in the same page? Part of the suite autocloses pages when they load, so if it's the latter I might not even see the issues before the tab closes.

User avatar
Racoda
Attaché
 
Posts: 85
Founded: Aug 12, 2014
Liberal Democratic Socialists

Postby Racoda » Fri Sep 25, 2020 4:31 pm

[violet] wrote:This might be consistent now.

By the way, I've been trying to track down a weird /asnation= bug forever, where sometimes we seem to get nations loaded as strings instead of objects. Have you encountered any strange page errors when using /asnation?

Not an obvious "error", but when re-investigating a related bug, I discovered trying to login when using this link https://www.nationstates.net/asnation=rsca/nation=racoda, when not logged in to any nation, generated a weird url:
Code: Select all
https://www.nationstates.net/page=display_other_nation/asnation=rsca/nref=Nation%253DHASH%25280x7f5c4cd9bd68%2529

The HTML login form also includes the same weirdness at the end:
Code: Select all
<input type="hidden" name="target" value="display_other_nation">
<input type="hidden" name="target_parameters" value="nref=Nation%3DHASH%280x7f5c4cd9bd68%29&amp;asnation=rsca">
</form>


Hope this proves useful.
Last edited by Racoda on Fri Sep 25, 2020 4:32 pm, edited 2 times in total.

User avatar
[violet]
Site Admin
 
Posts: 14646
Founded: Antiquity

Postby [violet] » Sat Sep 26, 2020 11:14 pm

YES that's it!! Brilliant, thank you.


Return to Technical

Who is online

Users browsing this forum: No registered users

Advertisement

Remove ads