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.

same problem for me on NC 24.0.1