vojtasvoboda / oc-codelogin-plugin

Code login plugin for OctoberCMS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What about wrong codes?

wmunguiam opened this issue · comments

Hi! Interesting plugin!
Tested and works well but not sure about "Wrong code" event.
I only receive:
Error
We're sorry, but an unhandled error occurred. Please see the details below.
Wrong code!
/var/www/html/usi/plugins/vojtasvoboda/codelogin/components/CodeLogin.php line 95
/*
* Find user by password
*/
$users = new UserRepository();
$userToLog = $users->getUserByPassword(array_get($data, 'code'));
if ($userToLog === null) {
$exception = new ValidationException([trans('vojtasvoboda.codelogin::lang.form.wrong_code')]);
throw $exception;
}

    /*
     * Authenticate user
     */

Do I have to work in "exception" condition? Or this is itegrated in plugin's components?

Hi. This exception is automatically handled by October AJAX framework, so be sure you have framework and framework extras directive included in your layout. For more see Readme, chapter 1.

:S

Strange behaviour....

I checked directives and they are listed:

...

<script type="text/javascript" src="{{ 'assets/js/html5shiv.js'|theme }}"></script> <script type="text/javascript" src="{{ 'assets/js/respond.min.js'|theme }}"></script> <script type="text/javascript" src="{{ 'assets/js/jquery.js'|theme }}"></script> <script type="text/javascript" src="{{ 'assets/js/bootstrap.min.js'|theme }}"></script> <script type="text/javascript" src="{{ 'assets/js/jquery.prettyPhoto.js'|theme }}"></script> <script type="text/javascript" src="{{ 'assets/js/jquery.isotope.min.js'|theme }}"></script> <script type="text/javascript" src="{{ 'assets/js/main.js'|theme }}"></script> <script type="text/javascript" src="{{ 'assets/js/wow.min.js'|theme }}"></script>

{% component 'session' %}
{% framework %}
{% framework extras %}
{% scripts %}

October version: system Build 414,

Wow, that is strange. There has to be some changes in Ajax framework. I made a fix, can you please test it?

bb8c97e

Thanks a lot for reporting issue.

Same behaviour:

Edited file with line sent:
/var/www/html/sistemas/plugins/vojtasvoboda/codelogin/components/codelogin/default.htm

When I go to protected Page, it redirects to Login Page
If I put rigth Code, Protected page is shown
If I put a wrong Code, Exeption error Page is shown (attached) :(
codeplugin

Sorry for the long delay. I found the problem and make new version 1.0.5 (now ready at the Market).

I've tested it on fresh CMS installation and everything works well with right login and also with bad one.

Could you please test it? Thank a lot.