inital commit
This commit is contained in:
54
app/Rules/PasswordValidationRule.php
Normal file
54
app/Rules/PasswordValidationRule.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Rules;
|
||||
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
|
||||
class PasswordValidationRule implements Rule
|
||||
{
|
||||
protected string $password_validation_rule = '/^(?=[-a-zA-Z0-9!@_*.]*$).*/';
|
||||
/**
|
||||
* Create a new rule instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the validation rule passes.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
$inputData = request()->all();
|
||||
$source_type = '';
|
||||
if(!empty($inputData['creditreport'])){
|
||||
$source_type = $inputData['creditreport']['credit_report_company_type'];
|
||||
}if(!empty($inputData['source_type'])){
|
||||
$source_type = $inputData['source_type'];
|
||||
}
|
||||
if($source_type == config('constant.reportType.SMART_CREDIT'))
|
||||
{
|
||||
return preg_match($this->password_validation_rule,$value);
|
||||
}
|
||||
elseif ($source_type == config('constant.reportType.IDENTITY_IQ')){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation error message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
return 'Password do not match in provider.';
|
||||
}
|
||||
}
|
||||
54
app/Rules/ReCaptcha.php
Normal file
54
app/Rules/ReCaptcha.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Rules;
|
||||
|
||||
use App\Utility\Curl;
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
|
||||
class ReCaptcha implements Rule
|
||||
{
|
||||
/**
|
||||
* Create a new rule instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the validation rule passes.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
// google captcha url
|
||||
$url = "https://www.google.com/recaptcha/api/siteverify";
|
||||
|
||||
// captcha secret key and value from the UI
|
||||
$data = [
|
||||
'secret' => config('app.GOOGLE_RECAPTCHA_SECRET'),
|
||||
'response' => $value
|
||||
];
|
||||
|
||||
|
||||
|
||||
$response = (new Curl($url))->get($data);
|
||||
|
||||
return $response['success'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation error message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
return 'The validation error message.';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user