nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.54k stars 4.08k forks source link

Ability to set default_phone_region to none / E.164 only #49460

Open Justinzobel opened 4 days ago

Justinzobel commented 4 days ago

Is your feature request related to a problem? Please describe. The annoying message asking me to set a default phone region

Describe the solution you'd like The ability to set "none" for default_phone_region in the configuration to disable the message.

Describe alternatives you've considered N/A

Additional context The Nextcloud server is global and has no specific region.

Justinzobel commented 4 days ago

So apparently you can set:

  'default_phone_region' => 'none',

To dismiss the notification in the admin panel, but I'm not sure what effects it will have on the rest of Nextcloud.

Justinzobel commented 4 days ago

If this is indeed the solution it should be updated at https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#default-phone-region to indicate this can be done.

joshtrichards commented 3 days ago

As far as the setup check is concerned, it simply has to have a value.

https://github.com/nextcloud/server/blob/f1ba90d52da8652570dfc20de94c9995c3a4c494/apps/settings/lib/SetupChecks/DefaultPhoneRegionSet.php#L32-L39

As far as it's usage in the code elsewhere is concerned, it is (primarily) used to parse, validate, and reformat the number into E.164 format (i.e. +41446681800).

https://github.com/nextcloud/server/blob/f1ba90d52da8652570dfc20de94c9995c3a4c494/lib/private/PhoneNumberUtil.php#L31-L42

It's basically used to convert entered phone numbers into their proper E.164 format if they are not already in that format. If they're already in that format, it doesn't matter.

Put another way, if you can enter the number here without specifying a default country code - and it parses without an error - you're golden. That uses the same library we use to validate/etc.

Now we get to enforcing E.164 for all your users...

The Nextcloud server is global and has no specific region.

Unfortunately I don't know of a universally accepted "the world" and/or "none" equivalent two-letter country code. Even ZZ doesn't really work for these purposes.

Technically, if there is no default configured, we already require a E.164 number (i.e. one that starts with +) and won't accept anything less:

https://github.com/nextcloud/server/blob/f1ba90d52da8652570dfc20de94c9995c3a4c494/lib/private/Accounts/AccountManager.php#L107-L110

Users won't be able to enter their sort of "local" / friendly numbers, but any assumptions we'd be making would also be wrong for a truly diverse user base anyway.

I guess since the setup check (and other spots where we check for a missing country code) merely look for an empty value, we could add our own recognized value that we consider "set by the admin intentionally to accept E.164 only... just like if there was no region configured".

Perhaps none or outright just e164.

joshtrichards commented 3 days ago

To dismiss the notification in the admin panel, but I'm not sure what effects it will have on the rest of Nextcloud.

For users that enter an already fully compliant E.164 number, it'll be fine. For users that enter anything else, it should just fail to parse (which is what you want anyway).

Justinzobel commented 3 days ago

Excellent. I'll set my server to none then. Documentation of the ability to do this (should it not cuase any issues) would be awesome, thanks!