diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2017-04-27 12:27:36 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-04-28 23:41:38 -0300 |
commit | 806ca43b527809e6b37573b6995535638102039c (patch) | |
tree | 6fa63aa1c0db8207295645d06a37cd31cce6fa32 /settings | |
parent | 9480b29413daba34432885642b575065ed5f5d6d (diff) | |
download | nextcloud-server-806ca43b527809e6b37573b6995535638102039c.tar.gz nextcloud-server-806ca43b527809e6b37573b6995535638102039c.zip |
allow to display the verification code also while verification is already running
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'settings')
-rw-r--r-- | settings/Controller/UsersController.php | 28 | ||||
-rw-r--r-- | settings/js/federationsettingsview.js | 2 | ||||
-rw-r--r-- | settings/js/personal.js | 14 | ||||
-rw-r--r-- | settings/templates/personal.php | 17 |
4 files changed, 35 insertions, 26 deletions
diff --git a/settings/Controller/UsersController.php b/settings/Controller/UsersController.php index 38c555e6a50..f481629e98b 100644 --- a/settings/Controller/UsersController.php +++ b/settings/Controller/UsersController.php @@ -518,9 +518,10 @@ class UsersController extends Controller { * @PasswordConfirmationRequired * * @param string $account + * @param bool $onlyVerificationCode only return verification code without updating the data * @return DataResponse */ - public function getVerificationCode($account) { + public function getVerificationCode($account, $onlyVerificationCode) { $user = $this->userSession->getUser(); @@ -554,19 +555,20 @@ class UsersController extends Controller { return new DataResponse([], Http::STATUS_BAD_REQUEST); } - $this->accountManager->updateUser($user, $accountData); + if ($onlyVerificationCode === false) { + $this->accountManager->updateUser($user, $accountData); - - $this->jobList->add('OC\Settings\BackgroundJobs\VerifyUserData', - [ - 'verificationCode' => $code, - 'data' => $data, - 'type' => $type, - 'uid' => $user->getUID(), - 'try' => 0, - 'lastRun' => $this->getCurrentTime() - ] - ); + $this->jobList->add('OC\Settings\BackgroundJobs\VerifyUserData', + [ + 'verificationCode' => $code, + 'data' => $data, + 'type' => $type, + 'uid' => $user->getUID(), + 'try' => 0, + 'lastRun' => $this->getCurrentTime() + ] + ); + } return new DataResponse(['msg' => $msg, 'code' => $code]); } diff --git a/settings/js/federationsettingsview.js b/settings/js/federationsettingsview.js index e8c6a84e1ec..f89aad2afd4 100644 --- a/settings/js/federationsettingsview.js +++ b/settings/js/federationsettingsview.js @@ -167,10 +167,12 @@ var verifyStatus = this.$('#' + field + 'form > .verify > #verify-' + field); verifyStatus.attr('title', t('core', 'Verify')); verifyStatus.attr('src', OC.imagePath('core', 'actions/verify.svg')); + verifyStatus.data('status', '0'); verifyStatus.addClass('verify-action'); } else if (field === 'email') { var verifyStatus = this.$('#' + field + 'form > .verify > #verify-' + field); verifyStatus.attr('title', t('core', 'Verifying …')); + verifyStatus.data('status', '1'); verifyStatus.attr('src', OC.imagePath('core', 'actions/verifying.svg')); } } diff --git a/settings/js/personal.js b/settings/js/personal.js index 3249382a88c..cd9fd3498b8 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -215,18 +215,26 @@ $(document).ready(function () { var verify = $(this); var indicator = $(this).children('img'); var accountId = indicator.attr('id'); + var status = indicator.data('status'); + + var onlyVerificationCode = false; + if (parseInt(status) === 1) { + onlyVerificationCode = true; + } if (indicator.hasClass('verify-action')) { $.ajax( OC.generateUrl('/settings/users/{account}/verify', {account: accountId}), - {method: 'GET'} + { + method: 'GET', + data: {onlyVerificationCode: onlyVerificationCode} + } ).done(function (data) { var dialog = verify.children('.verification-dialog'); showVerifyDialog($(dialog), data.msg, data.code); indicator.attr('title', t('core', 'Verifying …')); indicator.attr('src', OC.imagePath('core', 'actions/verifying.svg')); - indicator.removeClass('verify-action'); - + indicator.data('status', '1'); }); } diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 8dc2872e743..6cd9ac8f7be 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -106,13 +106,12 @@ print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '"'); break; case \OC\Accounts\AccountManager::VERIFIED: - print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '""'); + print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '"'); break; default: print_unescaped('src="' . image_path('core', 'actions/verify.svg') . '"'); } - print_unescaped(' title="' . $_['websiteMessage'] . '""'); - ?>> + ?> title="<?php p($_['emailMessage']); ?>"> </div> <input type="email" name="email" id="email" value="<?php p($_['email']); ?>" <?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?> @@ -167,10 +166,10 @@ <span class="icon-password"/> </h2> <div class="verify <?php if ($_['website'] === '' || $_['websiteScope'] !== 'public') p('hidden'); ?>"> - <img id="verify-website" <?php + <img id="verify-website" data-status="<?php p($_['websiteVerification']) ?>" <?php switch($_['websiteVerification']) { case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: - print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '"'); + print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '" class="verify-action"'); break; case \OC\Accounts\AccountManager::VERIFIED: print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '"'); @@ -178,8 +177,7 @@ default: print_unescaped('src="' . image_path('core', 'actions/verify.svg') . '" class="verify-action"'); } - print_unescaped(' title="' . $_['websiteMessage'] . '""'); - ?>> + ?> title="<?php p($_['websiteMessage']); ?>"> <div class="verification-dialog popovermenu bubble menu"> <div class="verification-dialog-content"> <p class="explainVerification"></p> @@ -205,7 +203,7 @@ <img id="verify-twitter" <?php switch($_['twitterVerification']) { case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: - print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '"'); + print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '" class="verify-action"'); break; case \OC\Accounts\AccountManager::VERIFIED: print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '"'); @@ -213,8 +211,7 @@ default: print_unescaped('src="' . image_path('core', 'actions/verify.svg') . '" class="verify-action"'); } - print_unescaped(' title="' . $_['twitterMessage'] . '""'); - ?>> + ?> title="<?php p($_['twitterMessage']); ?>"> <div class="verification-dialog popovermenu bubble menu"> <div class="verification-dialog-content"> <p class="explainVerification"></p> |