From 700677a9dd1f1fca2006e8bf8fb7171dd6d063a3 Mon Sep 17 00:00:00 2001
From: RomanSteinberg <romanofficial@yandex.ru>
Date: Fri, 3 Apr 2015 20:06:36 +0300
Subject: [PATCH] FIX: response for invalid email during pass recovery; FIX:
 press enter during pass recovery

---
 .../application/classes/Controller/Handler/Sign.php  |  7 ++++++-
 ~dev_rating/application/views/sign/up.twig           | 12 +++++-------
 ~dev_rating/media/js/sign.js                         |  6 +++++-
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/~dev_rating/application/classes/Controller/Handler/Sign.php b/~dev_rating/application/classes/Controller/Handler/Sign.php
index d7000893d..5612f5ead 100644
--- a/~dev_rating/application/classes/Controller/Handler/Sign.php
+++ b/~dev_rating/application/classes/Controller/Handler/Sign.php
@@ -81,9 +81,14 @@ class Controller_Handler_Sign extends Controller_Handler {
                 if(Account::instance()->isMailExists($email))
                 {
                     Account::instance()->createRecoveryRequest($this->post->offsetGet('email'));
+                    $response['success'] = true;
                 }
-                $response['success'] = true;
+                else
+                    $response['error'] = 'Пользователь с таким e-mail адресом не зарегистрирован в системе!';
             }
+            else
+                $response['error'] = 'Введенная строка не является e-mail адресом!';
+
             $this->response->body(json_encode($response));
         }
         
diff --git a/~dev_rating/application/views/sign/up.twig b/~dev_rating/application/views/sign/up.twig
index 9f854c6d4..aef48d40e 100644
--- a/~dev_rating/application/views/sign/up.twig
+++ b/~dev_rating/application/views/sign/up.twig
@@ -2,13 +2,11 @@
  
 {% block title %}Активация аккаунта{% endblock %}
 {% block forms %}
-    <div>
-        {{ sign.input('activation_code', 'text', '', 'Код активации') }}
-        {{ sign.input('login', 'text', '', 'Логин') }}
-        {{ sign.input('password', 'password', '', 'Пароль') }}
-        {{ sign.input('confirm_password', 'password', '', 'Подтверждение пароля') }}
-        {{ sign.input('email', 'text', '', 'E-Mail адрес') }}
-    </div>
+    {{ sign.input('activation_code', 'text', '', 'Код активации') }}
+    {{ sign.input('login', 'text', '', 'Логин') }}
+    {{ sign.input('password', 'password', '', 'Пароль') }}
+    {{ sign.input('confirm_password', 'password', '', 'Подтверждение пароля') }}
+    {{ sign.input('email', 'text', '', 'E-Mail адрес') }}
     {{ sign.input('signup_b', 'button', 'Активировать') }}
     <div class='footer'>
         {{ HTML.anchor('sign/in', 'Войти в существующий аккаунт')|raw }}
diff --git a/~dev_rating/media/js/sign.js b/~dev_rating/media/js/sign.js
index 55617a532..de7e9acb3 100644
--- a/~dev_rating/media/js/sign.js
+++ b/~dev_rating/media/js/sign.js
@@ -33,7 +33,7 @@ $(function()
             }
             else
             {
-                $('#remind').val('Что-то пошло не так :(');
+                EventInspector_ShowMsg(data.error, "error");
             }
         });
         
@@ -113,6 +113,10 @@ $(function()
             {
                 $('#signin_b').trigger('click');
             }
+            else if($('#email').is(':focus'))
+            {
+                $('#email').siblings('input[type=button]').trigger('click');
+            }
         }
     });
     
-- 
GitLab