Signed-off-by: Christopher Ng <chrng8@gmail.com>tags/v25.0.0beta4
field === 'displayname' || | field === 'displayname' || | ||||
field === 'twitter' || | field === 'twitter' || | ||||
field === 'address' || | field === 'address' || | ||||
field === 'website' | |||||
field === 'website' || | |||||
field === 'phone' | |||||
) { | ) { | ||||
return; | return; | ||||
} | } |
'federationEnabled' => $federationEnabled, | 'federationEnabled' => $federationEnabled, | ||||
'lookupServerUploadEnabled' => $lookupServerUploadEnabled, | 'lookupServerUploadEnabled' => $lookupServerUploadEnabled, | ||||
'avatarScope' => $account->getProperty(IAccountManager::PROPERTY_AVATAR)->getScope(), | 'avatarScope' => $account->getProperty(IAccountManager::PROPERTY_AVATAR)->getScope(), | ||||
'phone' => $account->getProperty(IAccountManager::PROPERTY_PHONE)->getValue(), | |||||
'phoneScope' => $account->getProperty(IAccountManager::PROPERTY_PHONE)->getScope(), | |||||
'groups' => $this->getGroups($user), | 'groups' => $this->getGroups($user), | ||||
'isFairUseOfFreePushService' => $this->isFairUseOfFreePushService(), | 'isFairUseOfFreePushService' => $this->isFairUseOfFreePushService(), | ||||
'profileEnabledGlobally' => $this->profileManager->isProfileEnabled(), | 'profileEnabledGlobally' => $this->profileManager->isProfileEnabled(), | ||||
'userId' => $uid, | 'userId' => $uid, | ||||
'displayName' => $this->getProperty($account, IAccountManager::PROPERTY_DISPLAYNAME), | 'displayName' => $this->getProperty($account, IAccountManager::PROPERTY_DISPLAYNAME), | ||||
'emailMap' => $this->getEmailMap($account), | 'emailMap' => $this->getEmailMap($account), | ||||
'phone' => $this->getProperty($account, IAccountManager::PROPERTY_PHONE), | |||||
'location' => $this->getProperty($account, IAccountManager::PROPERTY_ADDRESS), | 'location' => $this->getProperty($account, IAccountManager::PROPERTY_ADDRESS), | ||||
'website' => $this->getProperty($account, IAccountManager::PROPERTY_WEBSITE), | 'website' => $this->getProperty($account, IAccountManager::PROPERTY_WEBSITE), | ||||
'twitter' => $this->getProperty($account, IAccountManager::PROPERTY_TWITTER), | 'twitter' => $this->getProperty($account, IAccountManager::PROPERTY_TWITTER), |
<!-- | |||||
- @copyright 2022 Christopher Ng <chrng8@gmail.com> | |||||
- | |||||
- @author Christopher Ng <chrng8@gmail.com> | |||||
- | |||||
- @license AGPL-3.0-or-later | |||||
- | |||||
- This program is free software: you can redistribute it and/or modify | |||||
- it under the terms of the GNU Affero General Public License as | |||||
- published by the Free Software Foundation, either version 3 of the | |||||
- License, or (at your option) any later version. | |||||
- | |||||
- This program is distributed in the hope that it will be useful, | |||||
- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
- GNU Affero General Public License for more details. | |||||
- | |||||
- You should have received a copy of the GNU Affero General Public License | |||||
- along with this program. If not, see <http://www.gnu.org/licenses/>. | |||||
- | |||||
--> | |||||
<template> | |||||
<AccountPropertySection v-bind.sync="phone" | |||||
:placeholder="t('settings', 'Your phone number')" | |||||
type="tel" | |||||
:on-validate="onValidate" /> | |||||
</template> | |||||
<script> | |||||
import { isValidPhoneNumber } from 'libphonenumber-js' | |||||
import { loadState } from '@nextcloud/initial-state' | |||||
import AccountPropertySection from './shared/AccountPropertySection.vue' | |||||
import { NAME_READABLE_ENUM } from '../../constants/AccountPropertyConstants.js' | |||||
const { phone } = loadState('settings', 'personalInfoParameters', {}) | |||||
export default { | |||||
name: 'PhoneSection', | |||||
components: { | |||||
AccountPropertySection, | |||||
}, | |||||
data() { | |||||
return { | |||||
phone: { ...phone, readable: NAME_READABLE_ENUM[phone.name] }, | |||||
} | |||||
}, | |||||
methods: { | |||||
onValidate(value) { | |||||
return isValidPhoneNumber(value) | |||||
}, | |||||
}, | |||||
} | |||||
</script> |
import DisplayNameSection from './components/PersonalInfo/DisplayNameSection.vue' | import DisplayNameSection from './components/PersonalInfo/DisplayNameSection.vue' | ||||
import EmailSection from './components/PersonalInfo/EmailSection/EmailSection.vue' | import EmailSection from './components/PersonalInfo/EmailSection/EmailSection.vue' | ||||
import PhoneSection from './components/PersonalInfo/PhoneSection.vue' | |||||
import LocationSection from './components/PersonalInfo/LocationSection.vue' | import LocationSection from './components/PersonalInfo/LocationSection.vue' | ||||
import WebsiteSection from './components/PersonalInfo/WebsiteSection.vue' | import WebsiteSection from './components/PersonalInfo/WebsiteSection.vue' | ||||
import TwitterSection from './components/PersonalInfo/TwitterSection.vue' | import TwitterSection from './components/PersonalInfo/TwitterSection.vue' | ||||
const DisplayNameView = Vue.extend(DisplayNameSection) | const DisplayNameView = Vue.extend(DisplayNameSection) | ||||
const EmailView = Vue.extend(EmailSection) | const EmailView = Vue.extend(EmailSection) | ||||
const PhoneView = Vue.extend(PhoneSection) | |||||
const LocationView = Vue.extend(LocationSection) | const LocationView = Vue.extend(LocationSection) | ||||
const WebsiteView = Vue.extend(WebsiteSection) | const WebsiteView = Vue.extend(WebsiteSection) | ||||
const TwitterView = Vue.extend(TwitterSection) | const TwitterView = Vue.extend(TwitterSection) | ||||
new DisplayNameView().$mount('#vue-displayname-section') | new DisplayNameView().$mount('#vue-displayname-section') | ||||
new EmailView().$mount('#vue-email-section') | new EmailView().$mount('#vue-email-section') | ||||
new PhoneView().$mount('#vue-phone-section') | |||||
new LocationView().$mount('#vue-location-section') | new LocationView().$mount('#vue-location-section') | ||||
new WebsiteView().$mount('#vue-website-section') | new WebsiteView().$mount('#vue-website-section') | ||||
new TwitterView().$mount('#vue-twitter-section') | new TwitterView().$mount('#vue-twitter-section') |
<div id="vue-email-section"></div> | <div id="vue-email-section"></div> | ||||
</div> | </div> | ||||
<div class="personal-settings-setting-box"> | <div class="personal-settings-setting-box"> | ||||
<form id="phoneform" class="section"> | |||||
<h3> | |||||
<label for="phone"><?php p($l->t('Phone number')); ?></label> | |||||
<a href="#" class="federation-menu" aria-label="<?php p($l->t('Change privacy level of phone number')); ?>"> | |||||
<span class="icon-federation-menu icon-password"> | |||||
<span class="icon-triangle-s"></span> | |||||
</span> | |||||
</a> | |||||
</h3> | |||||
<input type="tel" id="phone" name="phone" value="<?php p($_['phone']) ?>" placeholder="<?php p($l->t('Your phone number')); ?>" autocomplete="on" autocapitalize="none" autocorrect="off" /> | |||||
<span class="icon-checkmark hidden"></span> | |||||
<span class="icon-error hidden"></span> | |||||
<input type="hidden" id="phonescope" value="<?php p($_['phoneScope']) ?>"> | |||||
</form> | |||||
<div id="vue-phone-section"></div> | |||||
</div> | </div> | ||||
<div class="personal-settings-setting-box"> | <div class="personal-settings-setting-box"> | ||||
<div id="vue-location-section"></div> | <div id="vue-location-section"></div> |
"jquery-ui": "^1.13.2", | "jquery-ui": "^1.13.2", | ||||
"jquery-ui-dist": "^1.13.1", | "jquery-ui-dist": "^1.13.1", | ||||
"jstimezonedetect": "^1.0.7", | "jstimezonedetect": "^1.0.7", | ||||
"libphonenumber-js": "^1.10.13", | |||||
"lodash": "^4.17.21", | "lodash": "^4.17.21", | ||||
"marked": "^4.0.14", | "marked": "^4.0.14", | ||||
"moment": "^2.29.2", | "moment": "^2.29.2", | ||||
"node": ">= 0.8.0" | "node": ">= 0.8.0" | ||||
} | } | ||||
}, | }, | ||||
"node_modules/libphonenumber-js": { | |||||
"version": "1.10.13", | |||||
"resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.13.tgz", | |||||
"integrity": "sha512-b74iyWmwb4GprAUPjPkJ11GTC7KX4Pd3onpJfKxYyY8y9Rbb4ERY47LvCMEDM09WD3thiLDMXtkfDK/AX+zT7Q==" | |||||
}, | |||||
"node_modules/lines-and-columns": { | "node_modules/lines-and-columns": { | ||||
"version": "1.2.4", | "version": "1.2.4", | ||||
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", | "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", | ||||
"type-check": "~0.4.0" | "type-check": "~0.4.0" | ||||
} | } | ||||
}, | }, | ||||
"libphonenumber-js": { | |||||
"version": "1.10.13", | |||||
"resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.13.tgz", | |||||
"integrity": "sha512-b74iyWmwb4GprAUPjPkJ11GTC7KX4Pd3onpJfKxYyY8y9Rbb4ERY47LvCMEDM09WD3thiLDMXtkfDK/AX+zT7Q==" | |||||
}, | |||||
"lines-and-columns": { | "lines-and-columns": { | ||||
"version": "1.2.4", | "version": "1.2.4", | ||||
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", | "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", |
"jquery-ui": "^1.13.2", | "jquery-ui": "^1.13.2", | ||||
"jquery-ui-dist": "^1.13.1", | "jquery-ui-dist": "^1.13.1", | ||||
"jstimezonedetect": "^1.0.7", | "jstimezonedetect": "^1.0.7", | ||||
"libphonenumber-js": "^1.10.13", | |||||
"lodash": "^4.17.21", | "lodash": "^4.17.21", | ||||
"marked": "^4.0.14", | "marked": "^4.0.14", | ||||
"moment": "^2.29.2", | "moment": "^2.29.2", |