make use of verification buttons

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
Bjoern Schiessle 2017-04-26 10:03:21 +02:00 committed by Morris Jobke
parent 2a07ec8e21
commit 06265fe770
No known key found for this signature in database
GPG Key ID: 9CE5ED29E7FCD38A
4 changed files with 35 additions and 28 deletions

View File

@ -196,15 +196,21 @@ class AccountManager {
// keep old verification status if we don't have a new one // keep old verification status if we don't have a new one
if(!isset($newData[self::PROPERTY_TWITTER]['verified'])) { if(!isset($newData[self::PROPERTY_TWITTER]['verified'])) {
$newData[self::PROPERTY_TWITTER]['verified'] = isset($oldData[self::PROPERTY_TWITTER]['verified']) ? $oldData[self::PROPERTY_TWITTER]['verified'] : self::NOT_VERIFIED; // keep old verification status if value didn't changed and an old value exists
$keepOldStatus = $newData[self::PROPERTY_TWITTER]['value'] === $oldData[self::PROPERTY_TWITTER]['value'] && isset($oldData[self::PROPERTY_TWITTER]['verified']);
$newData[self::PROPERTY_TWITTER]['verified'] = $keepOldStatus ? $oldData[self::PROPERTY_TWITTER]['verified'] : self::NOT_VERIFIED;
} }
if(!isset($newData[self::PROPERTY_WEBSITE]['verified'])) { if(!isset($newData[self::PROPERTY_WEBSITE]['verified'])) {
$newData[self::PROPERTY_WEBSITE]['verified'] = isset($oldData[self::PROPERTY_WEBSITE]['verified']) ? $oldData[self::PROPERTY_WEBSITE]['verified'] : self::NOT_VERIFIED; // keep old verification status if value didn't changed and an old value exists
$keepOldStatus = $newData[self::PROPERTY_WEBSITE]['value'] === $oldData[self::PROPERTY_WEBSITE]['value'] && isset($oldData[self::PROPERTY_WEBSITE]['verified']);
$newData[self::PROPERTY_WEBSITE]['verified'] = $keepOldStatus ? $oldData[self::PROPERTY_WEBSITE]['verified'] : self::NOT_VERIFIED;
} }
if(!isset($newData[self::PROPERTY_EMAIL]['verified'])) { if(!isset($newData[self::PROPERTY_EMAIL]['verified'])) {
$newData[self::PROPERTY_EMAIL]['verified'] = isset($oldData[self::PROPERTY_WEBSITE]['verified']) ? $oldData[self::PROPERTY_EMAIL]['verified'] : self::VERIFICATION_IN_PROGRESS; // keep old verification status if value didn't changed and an old value exists
$keepOldStatus = $newData[self::PROPERTY_EMAIL]['value'] === $oldData[self::PROPERTY_EMAIL]['value'] && isset($oldData[self::PROPERTY_EMAIL]['verified']);
$newData[self::PROPERTY_EMAIL]['verified'] = $keepOldStatus ? $oldData[self::PROPERTY_EMAIL]['verified'] : self::VERIFICATION_IN_PROGRESS;
} }
// reset verification status if a value from a previously verified data was changed // reset verification status if a value from a previously verified data was changed

View File

@ -144,7 +144,7 @@ input#openid, input#webdav { width:20em; }
padding-top: 10px; padding-top: 10px;
} }
#personal-settings-container .verify:hover { #personal-settings-container .verify-action {
cursor: pointer; cursor: pointer;
} }

View File

@ -208,15 +208,16 @@ $(document).ready(function () {
dialog.style.display = "block"; dialog.style.display = "block";
}; };
$(".verify").click(function () { $(".verify-action").click(function () {
var account = $(this).attr('id'); var account = $(this);
var accountId = $(this).attr('id');
// Add: make call to get content for verify dialog
$.ajax( $.ajax(
OC.generateUrl('/settings/users/{account}/verify', {account: account}), OC.generateUrl('/settings/users/{account}/verify', {account: accountId}),
{method: 'GET'} {method: 'GET'}
).done(function(data) { ).done(function(data) {
account.attr('title', 'Verifying...');
account.attr('src', OC.imagePath('core', 'actions/verifying.svg'));
showVerifyDialog(data.msg, data.code); showVerifyDialog(data.msg, data.code);
}); });

View File

@ -111,19 +111,20 @@
<label for="email"><?php p($l->t('Email')); ?></label> <label for="email"><?php p($l->t('Email')); ?></label>
<span class="icon-password"/> <span class="icon-password"/>
</h2> </h2>
<span class="verify" id="verify-email"><?php <span class="verify">
<img id="verify-email" <?php
switch($_['emailVerification']) { switch($_['emailVerification']) {
case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
p('verification in progress'); print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '" title="Verifying..."');
break; break;
case \OC\Accounts\AccountManager::VERIFIED: case \OC\Accounts\AccountManager::VERIFIED:
p('verified'); print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '" title="Verified"');
break; break;
default: default:
p('click to verify'); print_unescaped('src="' . image_path('core', 'actions/verify.svg') . '" title="Verify"');
} }
?> ?>>
</span> </span>
<input type="email" name="email" id="email" value="<?php p($_['email']); ?>" <input type="email" name="email" id="email" value="<?php p($_['email']); ?>"
<?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?> <?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
placeholder="<?php p($l->t('Your email address')); ?>" placeholder="<?php p($l->t('Your email address')); ?>"
@ -176,19 +177,19 @@
<label for="website"><?php p($l->t('Website')); ?></label> <label for="website"><?php p($l->t('Website')); ?></label>
<span class="icon-password"/> <span class="icon-password"/>
</h2> </h2>
<span class="verify" id="verify-website"> <span class="verify">
<?php <img id="verify-website" <?php
switch($_['websiteVerification']) { switch($_['websiteVerification']) {
case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
p('verification in progress'); print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '" title="Verifying..."');
break; break;
case \OC\Accounts\AccountManager::VERIFIED: case \OC\Accounts\AccountManager::VERIFIED:
p('verified'); print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '" title="Verified"');
break; break;
default: default:
p('click to verify'); print_unescaped('src="' . image_path('core', 'actions/verify.svg') . '" title="Verify" class="verify-action"');
} }
?> ?>>
</span> </span>
<input type="text" name="website" id="website" value="<?php p($_['website']); ?>" <input type="text" name="website" id="website" value="<?php p($_['website']); ?>"
placeholder="<?php p($l->t('Your website')); ?>" placeholder="<?php p($l->t('Your website')); ?>"
@ -203,20 +204,19 @@
<label for="twitter"><?php p($l->t('Twitter')); ?></label> <label for="twitter"><?php p($l->t('Twitter')); ?></label>
<span class="icon-password"/> <span class="icon-password"/>
</h2> </h2>
<span class="verify" id="verify-twitter"> <span class="verify">
<?php <img id="verify-twitter" <?php
switch($_['twitterVerification']) { switch($_['twitterVerification']) {
case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
p('verification in progress'); print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '" title="Verifying..."');
break; break;
case \OC\Accounts\AccountManager::VERIFIED: case \OC\Accounts\AccountManager::VERIFIED:
p('verified'); print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '" title="Verified"');
break; break;
default: default:
p('click to verify'); print_unescaped('src="' . image_path('core', 'actions/verify.svg') . '" title="Verify" class="verify-action"');
} }
?> ?>>
</span>
<input type="text" name="twitter" id="twitter" value="<?php p($_['twitter']); ?>" <input type="text" name="twitter" id="twitter" value="<?php p($_['twitter']); ?>"
placeholder="<?php p($l->t('Your Twitter handle')); ?>" placeholder="<?php p($l->t('Your Twitter handle')); ?>"
autocomplete="on" autocapitalize="none" autocorrect="off" /> autocomplete="on" autocapitalize="none" autocorrect="off" />