From cf8c32da925790f2b548de40e41b7ce0f613f6ec Mon Sep 17 00:00:00 2001 From: Visman Date: Thu, 8 Oct 2020 19:41:45 +0700 Subject: [PATCH] Change handling of some html forms --- app/Models/Pages/Auth.php | 7 +++++-- app/Models/Pages/Delete.php | 2 +- app/Models/Pages/Edit.php | 1 + app/Models/Pages/Email.php | 1 + app/Models/Pages/Post.php | 1 + app/Models/Pages/Profile/Config.php | 1 + app/Models/Pages/Profile/Edit.php | 1 + app/Models/Pages/Profile/Email.php | 1 + app/Models/Pages/Profile/Mod.php | 1 + app/Models/Pages/Profile/Pass.php | 2 +- app/Models/Pages/Register.php | 1 + app/Models/Pages/Report.php | 1 + 12 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/Models/Pages/Auth.php b/app/Models/Pages/Auth.php index 6626d609..eea81e26 100644 --- a/app/Models/Pages/Auth.php +++ b/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', diff --git a/app/Models/Pages/Delete.php b/app/Models/Pages/Delete.php index 3455406f..bfe168bf 100644 --- a/app/Models/Pages/Delete.php +++ b/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, diff --git a/app/Models/Pages/Edit.php b/app/Models/Pages/Edit.php index 7feaf4a8..af7fe5fc 100644 --- a/app/Models/Pages/Edit.php +++ b/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); } diff --git a/app/Models/Pages/Email.php b/app/Models/Pages/Email.php index b053f8a6..48d372d3 100644 --- a/app/Models/Pages/Email.php +++ b/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', diff --git a/app/Models/Pages/Post.php b/app/Models/Pages/Post.php index 2a0e36ed..5d1b1edb 100644 --- a/app/Models/Pages/Post.php +++ b/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); } diff --git a/app/Models/Pages/Profile/Config.php b/app/Models/Pages/Profile/Config.php index 2cf29265..0abfea5a 100644 --- a/app/Models/Pages/Profile/Config.php +++ b/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', diff --git a/app/Models/Pages/Profile/Edit.php b/app/Models/Pages/Profile/Edit.php index b07585c6..b66de5be 100644 --- a/app/Models/Pages/Profile/Edit.php +++ b/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', diff --git a/app/Models/Pages/Profile/Email.php b/app/Models/Pages/Profile/Email.php index 9ecbb4ae..b49bb703 100644 --- a/app/Models/Pages/Profile/Email.php +++ b/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', diff --git a/app/Models/Pages/Profile/Mod.php b/app/Models/Pages/Profile/Mod.php index 4041bbba..6ea6759f 100644 --- a/app/Models/Pages/Profile/Mod.php +++ b/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], diff --git a/app/Models/Pages/Profile/Pass.php b/app/Models/Pages/Profile/Pass.php index 1e02a4c0..f414224e 100644 --- a/app/Models/Pages/Profile/Pass.php +++ b/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,}$', diff --git a/app/Models/Pages/Register.php b/app/Models/Pages/Register.php index aee366f1..e7223abe 100644 --- a/app/Models/Pages/Register.php +++ b/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', diff --git a/app/Models/Pages/Report.php b/app/Models/Pages/Report.php index 925822cd..b7659ee8 100644 --- a/app/Models/Pages/Report.php +++ b/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([