Merge pull request #203 from My1/patch-1

fix issue with other characters in TOTP
This commit is contained in:
Christoph Wurst 2017-11-13 19:01:36 +01:00 коммит произвёл GitHub
Родитель 48c16247fb b12ddb2d5b
Коммит e873dd9062
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -29,7 +29,7 @@
+ ' <img src="{{qr}}">'
+ '</div>'
+ '<span>' + t('twofactor_totp', 'Once you have configured your app, enter a test code below to ensure that your app has been configured correctly.') + '<span><br>'
+ '<input id="totp-confirmation" type="tel" minlength="6" maxlength="6" autocomplete="off" autocapitalize="off" placeholder="' + t('twofactor_totp', 'Authentication code') + '">'
+ '<input id="totp-confirmation" type="tel" minlength="6" maxlength="10" autocomplete="off" autocapitalize="off" placeholder="' + t('twofactor_totp', 'Authentication code') + '">'
+ '<input id="totp-confirmation-submit" type="button" value="' + t('twofactor_totp', 'Verify') + '">'
+ '{{/if}}';
@ -238,4 +238,4 @@
OC.Settings.TwoFactorTotp.View = View;
})(OC, OC.Backbone, Handlebars, $, _);
})(OC, OC.Backbone, Handlebars, $, _);

Просмотреть файл

@ -89,6 +89,7 @@ class TotpProvider implements IProvider {
* @param string $challenge
*/
public function verifyChallenge(IUser $user, $challenge) {
$challenge = preg_replace('/[^0-9]/', '', $challenge);
return $this->totp->validateSecret($user, $challenge);
}

Просмотреть файл

@ -3,7 +3,7 @@ style('twofactor_totp', 'style');
?>
<form method="POST" class="totp-form">
<input type="tel" minlength="6" maxlength="6" name="challenge" required="required" autofocus autocomplete="off" autocapitalize="off" placeholder="<?php p($l->t('Authentication code')) ?>">
<input type="tel" minlength="6" maxlength="10" name="challenge" required="required" autofocus autocomplete="off" autocapitalize="off" placeholder="<?php p($l->t('Authentication code')) ?>">
<button type="submit">
<span><?php p($l->t('Submit')); ?></span>
</button>