Browse Source

Add Core\Test call

Visman 4 years ago
parent
commit
ee432334ab
3 changed files with 16 additions and 0 deletions
  1. 6 0
      app/Models/Pages/Auth.php
  2. 8 0
      app/Models/Pages/Post.php
  3. 2 0
      app/Models/Pages/Register.php

+ 6 - 0
app/Models/Pages/Auth.php

@@ -53,6 +53,8 @@ class Auth extends Page
                     'password' => 'Passphrase',
                 ]);
 
+            $v = $this->c->Test->beforeValidation($v);
+
             if ($v->validation($_POST, true)) {
                 return $this->c->Redirect->url($v->redirect)->message('Login redirect');
             }
@@ -186,6 +188,8 @@ class Auth extends Page
                     'email.email' => $tmpUser, // сюда идет возрат данных по найденному пользователю
                 ]);
 
+            $v = $this->c->Test->beforeValidation($v);
+
             if ($v->validation($_POST, true)) {
                 $key  = $this->c->Secury->randomPass(32);
                 $hash = $this->c->Secury->hash($tmpUser->id . $key);
@@ -317,6 +321,8 @@ class Auth extends Page
                     'password2.same'     => 'Pass not match',
                 ]);
 
+            $v = $this->c->Test->beforeValidation($v);
+
             if ($v->validation($_POST, true)) {
                 $user->password        = \password_hash($v->password, \PASSWORD_DEFAULT);
                 $user->email_confirmed = 1;

+ 8 - 0
app/Models/Pages/Post.php

@@ -35,6 +35,10 @@ class Post extends Page
         if ('POST' === $method) {
             $v = $this->messageValidator($forum, 'NewTopic', $args, false, true);
 
+            if ($this->user->isGuest) {
+                $v = $this->c->Test->beforeValidation($v);
+            }
+
             if (
                 $v->validation($_POST, $this->user->isGuest) //????
                 && null === $v->preview
@@ -93,6 +97,10 @@ class Post extends Page
         if ('POST' === $method) {
             $v = $this->messageValidator($topic, 'NewReply', $args);
 
+            if ($this->user->isGuest) {
+                $v = $this->c->Test->beforeValidation($v);
+            }
+
             if (
                 $v->validation($_POST, $this->user->isGuest) //????
                 && null === $v->preview

+ 2 - 0
app/Models/Pages/Register.php

@@ -39,6 +39,8 @@ class Register extends Page
                 'username.login'    => 'Login format',
             ]);
 
+        $v = $this->c->Test->beforeValidation($v);
+
         // завершение регистрации
         if (
             $v->validation($_POST, true)