ResetPasswordRequest.php 841 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Http\Requests\API\User;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class ResetPasswordRequest extends FormRequest
  5. {
  6. /**
  7. * Determine if the user is authorized to make this request.
  8. */
  9. public function authorize(): bool
  10. {
  11. return true;
  12. }
  13. /**
  14. * Get the validation rules that apply to the request.
  15. *
  16. * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
  17. */
  18. public function rules(): array
  19. {
  20. return [
  21. 'username' => 'required',
  22. 'code' => 'required',
  23. 'new_password' => 'required|min:6|regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{6,}$/',// 至少6位,包含大小写字母和数字,At least 6 digits, including upper and lower case letters and numbers
  24. ];
  25. }
  26. }