Unable to set phone number

Nextcloud version: 21.0.0
Operating system and version: Linux 5.10.21-Unraid 6.9.1
nginx version: 2018/08/16
PHP version: 7.4.15

The issue you are facing: I’m trying to input my phone number into the profile page for my user profile and no matter what format I input the phone number in, I get an error that says “Unable to set invalid phone number”. Nothing else is shown in the server logs. This is a brand new install on an Unraid server using the linuxserver Docker image.

Is this the first time you’ve seen this error? Yes

Steps to replicate it:

  1. Open dashboard in web browser (Chrome).
  2. Click on profile picture in top right corner and then on “Settings”.
  3. On “Personal Info” page, input phone number (Formats I tried are 4805554444, 480-555-4444, 14805554444, +14805554444, 1-480-555-4444, 480 555 4444, (480) 555-4444, etc.).
  4. Get error.

The output of your Nextcloud log in Admin > Logging:

No errors or warnings in log

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'datadirectory' => '/data',
  'instanceid' => 'redacted',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' => 
  array (
    0 => '192.168.1.25',
    1 => 'nextcloud.redacteddomain.com',
  ),
  'dbtype' => 'mysql',
  'version' => '21.0.0.18',
  'overwrite.cli.url' => 'https://nextcloud.redacteddomain.com',
  'overwritehost' => 'nextcloud.redacteddomain.com',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud',
  'dbhost' => '192.168.1.21:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '',
  'dbpassword' => '',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => '',
  'mail_domain' => '',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.mail.me.com',
  'mail_smtpport' => '587',
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
);

Someone reported this on GitHub (Phone number can't be set at user profile · Issue #25931 · nextcloud/server · GitHub)

They however said, that despite the error message, the telephone number is being saved in the profile. Can you confirm this?

It does not save for me. If I reload the page after entering a phone number, it does not repopulate the field.

Added the link to this thread on GitHub

Hi ahenriksen,
try adding the line below to your config file and save it:

‘default_phone_region’ => ‘DE’,

for me I put DE because I live in Germany.

I hope this helps

2 Likes

I just installed NextCloud too on our server, today and I having the exact same issue. It not accepting any phone numbers and give you the error message:
“Unable To Set Valid Phone Number”

Try the solution from @Cyrus_Rondolos above

Thank you for the suggestion @CFelix

However; that will lock the installation to only accept phone numbers from one specific country. So no other numbers with different country codes will be accepted.

Not a very viable solution when you have employees in several different countries in my opinion. :scream: :thinking:

1 Like

That just sets the default. I have mine set to “44” and am able to save other country numbers.

Hi AngryWarrior,

this can be achieved by putting the line below inside your config:

‘default_phone_region’ => ‘optional’,

with that you should be able to add any phone number. Of course, you have to add the country code in the beginning. For example, +1 for US, +49 for Germany, +44 for GB and so on.

I hope this helps.

2 Likes

Thanks a bunch @Cyrus_Rondolos for that tip. :heart: :facepunch:
That is very useful too.

Kind regards
AngryWarrior

Thanks! I can confirm that solution worked for me as well!

Sorry for the bump here, but is this still the preferred solution?

Is the phone number supposed to auto-format once you enter the +___ ? It doesn’t on my install.

Thanks!

Thank you! I used ‘default_phone_region’ => ‘US’, as I am in the US. Worked for me. For people who cut and paste, be careful of ‘smart’ quotes.

1 Like

same problem for me on NC 24.0.1

I am in the same boat, i cannot add it and i have tried US, CA, optional…nothing, i type in 1-3 digits and checkmark on the right appears before finishing. I am stumped.

I should add this is for version Nexcloud: 24.06

welcome to the community @koolandrew :handshake:

did you set your ‘default_phone_region’?

P.S.: you can edit your posts, no an extra post for typo correction…

lol, i iwill remember that.

Yes i have several times with different regions.

I even tried:

occ config:system:set default_phone_region --value="IT"

And got:

System config value default_phone_region set to string IT

I start entering phone number, get prompted for my password, and enter it, and then enter +14 and the checkmark appears and it closes. Same thing with other numbers with or without the plus sign.

However, when i enter an Italian number it actually works…i just noticed that.

It does not work at all when i change IT to CA, I get the same results.

I would conclude with this setup that you can only enter the numbers for that country only (ie +39 for italy) as you can enter the local portion and then there is a checkmark.

This is not great as this is setup for only numbers from one country code, and it doesnt work at all if that country code is +1

I have stumbled across a not-so-great solution, but it worked for me. Simply open up some type of notepad, type the number there and copy and then paste it to the phone number field. It actually worked for me, i would imagine others who are experiencing this issue.
For you more advanced technical wizards, i believe that the data entry times out for some reason, as i could only manually type a few digits before the checkmark was to appear.