Skip to content

Commit 9bcfa5e

Browse files
Pytalnextcloud-command
authored andcommitted
Fix default phone region validation
Signed-off-by: Christopher Ng <chrng8@gmail.com> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
1 parent 4694287 commit 9bcfa5e

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

apps/settings/lib/Settings/Personal/PersonalInfo.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ public function getForm(): TemplateResponse {
154154
'displayName' => $this->getProperty($account, IAccountManager::PROPERTY_DISPLAYNAME),
155155
'emailMap' => $this->getEmailMap($account),
156156
'phone' => $this->getProperty($account, IAccountManager::PROPERTY_PHONE),
157+
'defaultPhoneRegion' => $this->config->getSystemValueString('default_phone_region'),
157158
'location' => $this->getProperty($account, IAccountManager::PROPERTY_ADDRESS),
158159
'website' => $this->getProperty($account, IAccountManager::PROPERTY_WEBSITE),
159160
'twitter' => $this->getProperty($account, IAccountManager::PROPERTY_TWITTER),

apps/settings/src/components/PersonalInfo/PhoneSection.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ import AccountPropertySection from './shared/AccountPropertySection.vue'
3535
3636
import { NAME_READABLE_ENUM } from '../../constants/AccountPropertyConstants.js'
3737
38-
const { phone } = loadState('settings', 'personalInfoParameters', {})
38+
const {
39+
defaultPhoneRegion,
40+
phone,
41+
} = loadState('settings', 'personalInfoParameters', {})
3942
4043
export default {
4144
name: 'PhoneSection',
@@ -52,6 +55,9 @@ export default {
5255
5356
methods: {
5457
onValidate(value) {
58+
if (defaultPhoneRegion) {
59+
return isValidPhoneNumber(value, defaultPhoneRegion)
60+
}
5561
return isValidPhoneNumber(value)
5662
},
5763
},

dist/settings-vue-settings-personal-info.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/settings-vue-settings-personal-info.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)