Skip to content

feat: multiple phone number for profile#61125

Open
mykh-hailo wants to merge 1 commit into
nextcloud:masterfrom
mykh-hailo:feat/multiple-phone-number
Open

feat: multiple phone number for profile#61125
mykh-hailo wants to merge 1 commit into
nextcloud:masterfrom
mykh-hailo:feat/multiple-phone-number

Conversation

@mykh-hailo

@mykh-hailo mykh-hailo commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

This change adds support for multiple phone numbers on user accounts, following the same model as additional email addresses.

Previously, personal settings only exposed a single primary phone number via AccountPropertySection. Users can now manage a primary phone number plus additional numbers, including federation scope per entry, from SettingsPersonal info.

Backend

  • Introduce IAccountManager::COLLECTION_PHONE (additional_phone) as a new account property collection (since 33.0.0).
  • Extend the Provisioning API (UsersController) to add, update, remove, and scope additional phone numbers, with the same permission checks used for additional emails.
  • Expose additional_phone and additional_phoneScope in OCS user data responses (AUserDataOCSController).
  • Sanitize additional phone numbers in AccountManager using the existing E.164 validation path.
  • Include additional phone numbers when exporting CardDAV vCards (Converter).
  • Update OpenAPI definitions for the new fields.

Frontend(settings app)

  • Replace the single-field PhoneSection.vue with a dedicated PhoneSection/ component structure:
    • PhoneSection.vue — section layout, validation, and primary/additional phone coordination
    • PhoneSectionEntry.vue — individual phone input with federation controls and actions
    • PhoneService.js — OCS API client for primary and additional phone operations
  • Extend AccountPropertyConstants with PHONE_COLLECTION, readable labels, supported scopes, and DEFAULT_ADDITIONAL_PHONE_SCOPE.
  • Provide phoneMap (primary + additional phones) via initial state in PersonalInfo.php instead of a single phone property.

Behavior

  • Additional phone numbers are validated client-side (libphonenumber-js) and server-side (existing phone sanitization).
  • Duplicate numbers (including matching the primary phone) are rejected by the API.
  • Updating phone numbers clears known-user contact matches, consistent with primary phone changes.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: mykh-hailo <kristianderonta0205@gmail.com>
@mykh-hailo mykh-hailo requested review from CarlSchwan, leftybournes, nfebe, salmart-dev, sorbaugh and susnux and removed request for a team June 9, 2026 20:13
@sorbaugh

Copy link
Copy Markdown
Contributor

Thank you for the PR! We'll be reviewing it shortly.

@susnux susnux added enhancement 3. to review Waiting for reviews labels Jun 10, 2026
@susnux susnux added this to the Nextcloud 35 milestone Jun 10, 2026
public const COLLECTION_EMAIL = 'additional_mail';

/**
* @since 33.0.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be 35

const userId = getCurrentUser().uid
const url = generateOcsUrl('cloud/users/{userId}', { userId })

await confirmPassword()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is a bit cleaner to use the axios interceptors:
https://nextcloud-libraries.github.io/nextcloud-password-confirmation/functions/addPasswordConfirmationInterceptors.html

Just register them once in this module then you can use confirmPassword axios option.

</section>
</template>

<script>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use script setup and Typescript for new Vue files.

</div>
</template>

<script>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use script setup and Typescript for new Vue files.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please no new Javascript files, use Typescript instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to add multiple phone numbers to the profile

3 participants