Use constants from interface rather than class

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2021-01-29 20:32:41 +01:00
parent 513aba623e
commit 8cae515daa
2 changed files with 21 additions and 21 deletions

View File

@ -523,14 +523,14 @@ class UsersController extends Controller {
switch ($account) { switch ($account) {
case 'verify-twitter': case 'verify-twitter':
$accountData[IAccountManager::PROPERTY_TWITTER]['verified'] = AccountManager::VERIFICATION_IN_PROGRESS; $accountData[IAccountManager::PROPERTY_TWITTER]['verified'] = IAccountManager::VERIFICATION_IN_PROGRESS;
$msg = $this->l10n->t('In order to verify your Twitter account, post the following tweet on Twitter (please make sure to post it without any line breaks):'); $msg = $this->l10n->t('In order to verify your Twitter account, post the following tweet on Twitter (please make sure to post it without any line breaks):');
$code = $codeMd5; $code = $codeMd5;
$type = IAccountManager::PROPERTY_TWITTER; $type = IAccountManager::PROPERTY_TWITTER;
$accountData[IAccountManager::PROPERTY_TWITTER]['signature'] = $signature; $accountData[IAccountManager::PROPERTY_TWITTER]['signature'] = $signature;
break; break;
case 'verify-website': case 'verify-website':
$accountData[IAccountManager::PROPERTY_WEBSITE]['verified'] = AccountManager::VERIFICATION_IN_PROGRESS; $accountData[IAccountManager::PROPERTY_WEBSITE]['verified'] = IAccountManager::VERIFICATION_IN_PROGRESS;
$msg = $this->l10n->t('In order to verify your Website, store the following content in your web-root at \'.well-known/CloudIdVerificationCode.txt\' (please make sure that the complete text is in one line):'); $msg = $this->l10n->t('In order to verify your Website, store the following content in your web-root at \'.well-known/CloudIdVerificationCode.txt\' (please make sure that the complete text is in one line):');
$type = IAccountManager::PROPERTY_WEBSITE; $type = IAccountManager::PROPERTY_WEBSITE;
$accountData[IAccountManager::PROPERTY_WEBSITE]['signature'] = $signature; $accountData[IAccountManager::PROPERTY_WEBSITE]['signature'] = $signature;

View File

@ -209,42 +209,42 @@ class UsersControllerTest extends \Test\TestCase {
IAccountManager::PROPERTY_DISPLAYNAME => IAccountManager::PROPERTY_DISPLAYNAME =>
[ [
'value' => 'Display name', 'value' => 'Display name',
'scope' => AccountManager::SCOPE_FEDERATED, 'scope' => IAccountManager::SCOPE_FEDERATED,
'verified' => AccountManager::NOT_VERIFIED, 'verified' => IAccountManager::NOT_VERIFIED,
], ],
IAccountManager::PROPERTY_ADDRESS => IAccountManager::PROPERTY_ADDRESS =>
[ [
'value' => '', 'value' => '',
'scope' => AccountManager::SCOPE_LOCAL, 'scope' => IAccountManager::SCOPE_LOCAL,
'verified' => AccountManager::NOT_VERIFIED, 'verified' => IAccountManager::NOT_VERIFIED,
], ],
IAccountManager::PROPERTY_WEBSITE => IAccountManager::PROPERTY_WEBSITE =>
[ [
'value' => '', 'value' => '',
'scope' => AccountManager::SCOPE_LOCAL, 'scope' => IAccountManager::SCOPE_LOCAL,
'verified' => AccountManager::NOT_VERIFIED, 'verified' => IAccountManager::NOT_VERIFIED,
], ],
IAccountManager::PROPERTY_EMAIL => IAccountManager::PROPERTY_EMAIL =>
[ [
'value' => '', 'value' => '',
'scope' => AccountManager::SCOPE_FEDERATED, 'scope' => IAccountManager::SCOPE_FEDERATED,
'verified' => AccountManager::NOT_VERIFIED, 'verified' => IAccountManager::NOT_VERIFIED,
], ],
IAccountManager::PROPERTY_AVATAR => IAccountManager::PROPERTY_AVATAR =>
[ [
'scope' => AccountManager::SCOPE_FEDERATED 'scope' => IAccountManager::SCOPE_FEDERATED
], ],
IAccountManager::PROPERTY_PHONE => IAccountManager::PROPERTY_PHONE =>
[ [
'value' => '', 'value' => '',
'scope' => AccountManager::SCOPE_LOCAL, 'scope' => IAccountManager::SCOPE_LOCAL,
'verified' => AccountManager::NOT_VERIFIED, 'verified' => IAccountManager::NOT_VERIFIED,
], ],
IAccountManager::PROPERTY_TWITTER => IAccountManager::PROPERTY_TWITTER =>
[ [
'value' => '', 'value' => '',
'scope' => AccountManager::SCOPE_LOCAL, 'scope' => IAccountManager::SCOPE_LOCAL,
'verified' => AccountManager::NOT_VERIFIED, 'verified' => IAccountManager::NOT_VERIFIED,
], ],
]); ]);
@ -504,18 +504,18 @@ class UsersControllerTest extends \Test\TestCase {
public function dataTestGetVerificationCode() { public function dataTestGetVerificationCode() {
$accountDataBefore = [ $accountDataBefore = [
IAccountManager::PROPERTY_WEBSITE => ['value' => 'https://nextcloud.com', 'verified' => AccountManager::NOT_VERIFIED], IAccountManager::PROPERTY_WEBSITE => ['value' => 'https://nextcloud.com', 'verified' => IAccountManager::NOT_VERIFIED],
IAccountManager::PROPERTY_TWITTER => ['value' => '@nextclouders', 'verified' => AccountManager::NOT_VERIFIED, 'signature' => 'theSignature'], IAccountManager::PROPERTY_TWITTER => ['value' => '@nextclouders', 'verified' => IAccountManager::NOT_VERIFIED, 'signature' => 'theSignature'],
]; ];
$accountDataAfterWebsite = [ $accountDataAfterWebsite = [
IAccountManager::PROPERTY_WEBSITE => ['value' => 'https://nextcloud.com', 'verified' => AccountManager::VERIFICATION_IN_PROGRESS, 'signature' => 'theSignature'], IAccountManager::PROPERTY_WEBSITE => ['value' => 'https://nextcloud.com', 'verified' => IAccountManager::VERIFICATION_IN_PROGRESS, 'signature' => 'theSignature'],
IAccountManager::PROPERTY_TWITTER => ['value' => '@nextclouders', 'verified' => AccountManager::NOT_VERIFIED, 'signature' => 'theSignature'], IAccountManager::PROPERTY_TWITTER => ['value' => '@nextclouders', 'verified' => IAccountManager::NOT_VERIFIED, 'signature' => 'theSignature'],
]; ];
$accountDataAfterTwitter = [ $accountDataAfterTwitter = [
IAccountManager::PROPERTY_WEBSITE => ['value' => 'https://nextcloud.com', 'verified' => AccountManager::NOT_VERIFIED], IAccountManager::PROPERTY_WEBSITE => ['value' => 'https://nextcloud.com', 'verified' => IAccountManager::NOT_VERIFIED],
IAccountManager::PROPERTY_TWITTER => ['value' => '@nextclouders', 'verified' => AccountManager::VERIFICATION_IN_PROGRESS, 'signature' => 'theSignature'], IAccountManager::PROPERTY_TWITTER => ['value' => '@nextclouders', 'verified' => IAccountManager::VERIFICATION_IN_PROGRESS, 'signature' => 'theSignature'],
]; ];
return [ return [