Ver código fonte

Change handling of some html forms

Visman 4 anos atrás
pai
commit
cf8c32da92

+ 5 - 2
app/Models/Pages/Auth.php

@@ -47,6 +47,7 @@ class Auth extends Page
                     'username' => 'required|string',
                     'password' => 'required|string|login_process',
                     'save'     => 'checkbox',
+                    'login'    => 'required|string',
                 ])->addAliases([
                     'username' => 'Username',
                     'password' => 'Passphrase',
@@ -175,8 +176,9 @@ class Auth extends Page
             $v = $this->c->Validator->reset()
                 ->addValidators([
                 ])->addRules([
-                    'token' => 'token:Forget',
-                    'email' => 'required|string:trim|email:noban,exists,flood',
+                    'token'  => 'token:Forget',
+                    'email'  => 'required|string:trim|email:noban,exists,flood',
+                    'submit' => 'required|string',
                 ])->addAliases([
                 ])->addMessages([
                     'email.email' => 'Invalid email',
@@ -304,6 +306,7 @@ class Auth extends Page
                     'token'     => 'token:ChangePassword',
                     'password'  => 'required|string|min:16|password',
                     'password2' => 'required|same:password',
+                    'submit'    => 'required|string',
                 ])->addAliases([
                     'password'  => 'New pass',
                     'password2' => 'Confirm new pass',

+ 1 - 1
app/Models/Pages/Delete.php

@@ -33,7 +33,7 @@ class Delete extends Page
                 ->addRules([
                     'token'   => 'token:DeletePost',
                     'confirm' => 'integer', // ????
-                    'delete'  => 'string',
+                    'delete'  => 'required|string',
                 ])->addAliases([
                 ])->addArguments([
                     'token' => $args,

+ 1 - 0
app/Models/Pages/Edit.php

@@ -37,6 +37,7 @@ class Edit extends Page
             if (
                 $v->validation($_POST)
                 && null === $v->preview
+                && null !== $v->submit
             ) {
                 return $this->endEdit($post, $v);
             }

+ 1 - 0
app/Models/Pages/Email.php

@@ -55,6 +55,7 @@ class Email extends Page
                 'redirect'    => 'required|referer:Index',
                 'subject'     => 'required|string:trim|max:70',
                 'message'     => 'required|string:trim,linebreaks|max:65000 bytes',
+                'send'        => 'required|string',
             ])->addAliases([
                 'subject'     => 'Email subject',
                 'message'     => 'Email message',

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

@@ -38,6 +38,7 @@ class Post extends Page
             if (
                 $v->validation($_POST)
                 && null === $v->preview
+                && null !== $v->submit
             ) {
                 return $this->endPost($forum, $v);
             }

+ 1 - 0
app/Models/Pages/Profile/Config.php

@@ -48,6 +48,7 @@ class Config extends Profile
                         ? '0,1,2'
                         : (int) $this->curUser->ip_check_type
                     ),
+                    'save'          => 'required|string',
                 ])->addAliases([
                     'language'      => 'Language',
                     'style'         => 'Style',

+ 1 - 0
app/Models/Pages/Profile/Edit.php

@@ -88,6 +88,7 @@ class Edit extends Profile
                     'email_setting' => 'required|integer|in:0,1,2',
                     'url'           => $ruleWebsite,
                     'signature'     => $ruleSignature,
+                    'save'          => 'required|string',
                 ])->addAliases([
                     'username'      => 'Username',
                     'title'         => 'Title',

+ 1 - 0
app/Models/Pages/Profile/Email.php

@@ -62,6 +62,7 @@ class Email extends Profile
                     'token'     => 'token:EditUserEmail',
                     'password'  => 'required|string:trim|check_password',
                     'new_email' => 'required|string:trim|email:noban,unique,flood',
+                    'submit'    => 'required|string',
                 ])->addAliases([
                     'new_email' => 'New email',
                     'password'  => 'Your passphrase',

+ 1 - 0
app/Models/Pages/Profile/Mod.php

@@ -33,6 +33,7 @@ class Mod extends Profile
                 ])->addRules([
                     'token'       => 'token:EditUserModeration',
                     'moderator.*' => 'integer|in:' . \implode(',', \array_keys($this->curForums)),
+                    'save'        => 'required|string',
                 ])->addAliases([
                 ])->addArguments([
                     'token'       => ['id' => $this->curUser->id],

+ 1 - 1
app/Models/Pages/Profile/Pass.php

@@ -34,6 +34,7 @@ class Pass extends Profile
                     'token'     => 'token:EditUserPass',
                     'password'  => 'required|string:trim|check_password',
                     'new_pass'  => 'required|string:trim|password',
+                    'submit'    => 'required|string',
                 ])->addAliases([
                     'new_pass'  => 'New pass',
                     'password'  => 'Your passphrase',
@@ -115,7 +116,6 @@ class Pass extends Profile
                     'fields' => [
                         'new_pass' => [
                             'type'      => 'password',
-                            'maxlength' => 25,
                             'caption'   => __('New pass'),
                             'required'  => true,
                             'pattern'   => '^.{16,}$',

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

@@ -27,6 +27,7 @@ class Register extends Page
                 'email'    => 'required_with:on|string:trim|email:noban,unique',
                 'username' => 'required_with:on|string:trim,spaces|username',
                 'password' => 'required_with:on|string|min:16|password',
+                'register' => 'required|string',
             ])->addAliases([
                 'email'    => 'Email',
                 'username' => 'Username',

+ 1 - 0
app/Models/Pages/Report.php

@@ -40,6 +40,7 @@ class Report extends Page
             ])->addRules([
                 'token'       => 'token:ReportPost',
                 'reason'      => 'required|string:trim,linebreaks|max:65000 bytes',
+                'submit'      => 'required|string',
             ])->addAliases([
                 'reason'      => 'Reason',
             ])->addArguments([