「パスワードの半角数のエラーが修正されていないかと思います。」

このコミットが含まれているのは:
守矢諏訪子 2021-12-19 11:32:45 +09:00
コミット ee3dbf58f1
4個のファイルの変更24行の追加5行の削除

ファイルの表示

@ -36,7 +36,7 @@ trait AuthenticationTrait {
$validate = Validator::make($r->all(), [
$chk[0] => 'required|'.$chk[2],
'password' => 'required|min:8|max:72|alpha_num',
'password' => ['required', 'min:8', 'max:72', new \App\Rules\Hankaku],
]);
// バリデーションエラー

ファイルの表示

@ -126,7 +126,7 @@ class ChildrenController extends Controller {
$validate = Validator::make($r->all(), [
'identity' => 'required|max:20|alpha_num',
'email' => 'required|unique:children|max:255|email',
'password' => 'required|min:8|max:72|confirmed|alpha_num',
'password' => ['required', 'min:8', 'max:72', 'confirmed', new \App\Rules\Hankaku],
'last_name' => 'required|max:100',
'first_name' => 'required|max:100',
'image' => 'image_size|image_meme',
@ -529,7 +529,7 @@ class ChildrenController extends Controller {
// バリデーションエラー
$validate = Validator::make($r->all(), [
'password' => 'required|min:8|max:72|confirmed|alpha_num',
'password' => ['required', 'min:8', 'max:72', 'confirmed', new \App\Rules\Hankaku],
]);
if ($validate->fails()) {

ファイルの表示

@ -167,7 +167,7 @@ class FathersController extends Controller {
$validate = Validator::make($r->all(), [
'token' => 'required',
'password' => 'required|min:8|max:72|confirmed|alpha_num',
'password' => ['required', 'min:8', 'max:72', 'confirmed', new \App\Rules\Hankaku],
'company' => 'required|max:100',
'image' => 'image_size|image_meme',
'profile' => 'max:1000',
@ -479,7 +479,7 @@ class FathersController extends Controller {
// バリデーションエラー
$validate = Validator::make($r->all(), [
'password' => 'required|min:8|max:72|confirmed|alpha_num',
'password' => ['required', 'min:8', 'max:72', 'confirmed', new \App\Rules\Hankaku],
]);
if ($validate->fails()) {

19
backend/app/Rules/Hankaku.php ノーマルファイル
ファイルの表示

@ -0,0 +1,19 @@
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
class Hankaku implements Rule {
public function __construct () {
//
}
public function passes ($attribute, $value) {
return preg_match('/^[a-zA-Z0-9]+$/', $value);
}
public function message () {
return trans('validation.alpha_num');
}
}