Plugin: Whispeak improve UI - refs BT#15816

pull/3377/head
Angel Fernando Quiroz Campos 7 years ago
parent c969f55872
commit bb196a0898
  1. 7
      plugin/whispeakauth/WhispeakAuthPlugin.php
  2. 10
      plugin/whispeakauth/ajax/authentify_password.php
  3. 4
      plugin/whispeakauth/authentify.php
  4. 1
      plugin/whispeakauth/authentify_password.php
  5. 7
      plugin/whispeakauth/view/authentify_password.html.twig

@ -725,4 +725,11 @@ class WhispeakAuthPlugin extends Plugin implements HookPluginInterface
return false;
}
public static function displayNotAllowedMessage()
{
echo Display::return_message(get_lang('NotAllowed'), 'error', false);
exit;
}
}

@ -14,7 +14,7 @@ $plugin->protectTool(false);
$tokenIsValid = Security::check_token();
if (!$tokenIsValid) {
api_not_allowed(false);
WhispeakAuthPlugin::displayNotAllowedMessage();
}
$maxAttempts = $plugin->getMaxAttempts();
@ -30,11 +30,11 @@ $user = api_get_user_entity(api_get_user_id());
$password = isset($_POST['password']) ? $_POST['password'] : null;
if (empty($password) || empty($user)) {
api_not_allowed(false);
WhispeakAuthPlugin::displayNotAllowedMessage();
}
if (!in_array($user->getAuthSource(), [PLATFORM_AUTH_SOURCE, CAS_AUTH_SOURCE])) {
api_not_allowed(false);
WhispeakAuthPlugin::displayNotAllowedMessage();
}
$isValidPassword = UserManager::isPasswordValid($user->getPassword(), $password, $user->getSalt());
@ -67,7 +67,7 @@ if (!$isValidPassword || !$isActive || !$isExpired) {
echo Display::return_message($message, 'error', false);
if ($maxAttempts && $failedLogins >= $maxAttempts) {
$userPass = true;
//$userPass = true;
}
} elseif ($isValidPassword) {
echo Display::return_message($plugin->get_lang('AuthentifySuccess'), 'success');
@ -83,5 +83,5 @@ if ($userPass) {
echo '<script>window.setTimeout(function () {
window.location.href = "'.$lpItemInfo['src'].'";
}, 1500);</script>';
}, 1500);</script>';
}

@ -23,6 +23,10 @@ if ($userId) {
$wsid = WhispeakAuthPlugin::getAuthUidValue($userId);
if (empty($wsid)) {
Display::addFlash(
Display::return_message($plugin->get_lang('SpeechAuthNotEnrolled'), 'warning')
);
header('Location: '.api_get_path(WEB_PLUGIN_PATH).'whispeakauth/authentify_password.php');
exit;

@ -48,7 +48,6 @@ $template = new Template(
true,
false
);
$template->assign('message', Display::return_message($plugin->get_lang('SpeechAuthNotEnrolled'), 'warning'));
$template->assign('form', $form->returnForm());
$content = $template->fetch('whispeakauth/view/authentify_password.html.twig');

@ -1,8 +1,9 @@
<div class="row">
<div class="col-sm-5">
<div class="col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
{{ form }}
</div>
<div class="col-sm-7">
<br>
<div id="frm-login-result"></div>
</div>
</div>

Loading…
Cancel
Save