Collect: Use form-based hostname when asking for credentials

Created on 13 Mar 2017  路  9Comments  路  Source: getodk/collect

URLs specified in a form (submission_url), can override Collect's settings. When the user is asked for credentials, use the hostname in the URL and not the settings.

bug help wanted

Most helpful comment

Absolutely

All 9 comments

@yanokwa can i work on this? This is related to another issue "issue #538: If credentials are invalid tell the user ". I have submitted a patch for that issue. i think once that gets accepted this can be worked upon.

Yes please, @Midhun07.

@yanokwa i think i misunderstood the form that you have mentioned here. I searched the project files but didn't find such a form. Where am i getting wrong? Please guide.

@Midhun07 Sorry I wasn't clearer! Generally, forms post to the server URL that is in the settings. The XML of that form looks like this..

<model>
   <instance>

Forms can also post to form-specific URLs. This is required when using encrypted forms, but you can also just set it in regular forms.

<model>
   <submission action="https://nafundi-test.appspot.com/submission" method="form-data-post"/>
   <instance>

So in the case of a form submission where there is a form-specific URL and credentials are required, it'd be good if the error message referred to that form-specific hostname.

To test, set your device's server to https://opendatakit.appspot.com. Confirm this is working by getting blank form. You should see forms like Biggest N of Set, Birds, Cascading Select.

Now, rename this form (custom-url.xml.txt) to custom-url.xml and manually push it to your device. Note that the form XML has https://nafundi-test.appspot.com/submission as the submission url.

With your computer's browser, log into the https://nafundi-test.appspot.com with admin/admin. Go into Site Admin, then preferences, and uncheck all permissions for anonymousUser. Save Changes.

Now fill out the custom-url form on your device and try to send it in. It should show an alert that says you should enter the username and password for opendatakit.appspot.com. But that isn't correct! The server should be nafundi-test.appspot.com because that's what is in the form.

And to be extra sure things work when you are making your changes, try creating another user on the server with Data Collector privileges and make sure those credentials work.

When you are done testing, re-enable permissions for anonymousUser.

Hi @anudeepti2004! Can you give this issue a try?

Absolutely

ERROR: This issue is in progress, but has no assignee.

ERROR: This issue is in progress, but has no assignee.

@opendatakit-bot claim

Was this page helpful?
0 / 5 - 0 ratings