Whispeak: Don't show link to re-enrollment - refs BT#16215

pull/3377/head
Angel Fernando Quiroz Campos 6 years ago
parent a3131383c8
commit 17237761ea
  1. 5
      main/inc/lib/userportal.lib.php
  2. 10
      plugin/whispeakauth/enrollment.php
  3. 9
      plugin/whispeakauth/view/record_audio.html.twig

@ -954,7 +954,10 @@ class IndexManager
]; ];
} }
if (true === api_get_configuration_value('whispeak_auth_enabled')) { if (
true === api_get_configuration_value('whispeak_auth_enabled') &&
!WhispeakAuthPlugin::checkUserIsEnrolled($userId)
) {
$itemTitle = WhispeakAuthPlugin::create()->get_title(); $itemTitle = WhispeakAuthPlugin::create()->get_title();
$items[] = [ $items[] = [

@ -12,6 +12,15 @@ $plugin = WhispeakAuthPlugin::create();
$plugin->protectTool(); $plugin->protectTool();
$isEnrolledAlready = WhispeakAuthPlugin::checkUserIsEnrolled($userId);
if ($isEnrolledAlready) {
api_not_allowed(
true,
Display::return_message($plugin->get_lang('SpeechAuthAlreadyEnrolled'), 'warning')
);
}
try { try {
$sampleText = WhispeakAuthRequest::enrollmentSentence($plugin); $sampleText = WhispeakAuthRequest::enrollmentSentence($plugin);
} catch (Exception $exception) { } catch (Exception $exception) {
@ -27,7 +36,6 @@ $htmlHeadXtra[] = api_get_js('rtc/RecordRTC.js');
$htmlHeadXtra[] = api_get_js_simple(api_get_path(WEB_PLUGIN_PATH).'whispeakauth/assets/js/RecordAudio.js'); $htmlHeadXtra[] = api_get_js_simple(api_get_path(WEB_PLUGIN_PATH).'whispeakauth/assets/js/RecordAudio.js');
$template = new Template(); $template = new Template();
$template->assign('is_authenticated', WhispeakAuthPlugin::checkUserIsEnrolled($userId));
$template->assign('action', 'enrollment'); $template->assign('action', 'enrollment');
$template->assign('sample_text', $sampleText); $template->assign('sample_text', $sampleText);

@ -39,14 +39,7 @@
</div> </div>
<div class="col-sm-8 col-sm-offset-2 col-md-5 col-md-offset-1"> <div class="col-sm-8 col-sm-offset-2 col-md-5 col-md-offset-1">
<hr class="visible-sm"> <hr class="visible-sm">
<div id="messages-deck"> <div id="messages-deck"></div>
{% if is_authenticated %}
<div class="alert alert-info">
<span class="fa fa-info-circle" aria-hidden="true"></span>
<strong>{{ 'SpeechAuthAlreadyEnrolled'|get_plugin_lang('WhispeakAuthPlugin') }}</strong>
</div>
{% endif %}
</div>
<div class="hidden" id="audio-wrapper"> <div class="hidden" id="audio-wrapper">
<p> <p>
<audio class="center-block" controls id="record-preview"></audio> <audio class="center-block" controls id="record-preview"></audio>

Loading…
Cancel
Save