![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/ts.corals.io/corals-api/Corals/core/User/Rules/ |
<?php namespace Corals\User\Rules; use Illuminate\Contracts\Validation\Rule; class GoogleTokenMatch implements Rule { /** * Create a new rule instance. * * @return void */ public $token; public function __construct($token) { $this->token = $token; } /** * Determine if the validation rule passes. * * @param string $attribute * @param mixed $value * @return bool */ public function passes($attribute, $value) { try { $google2fa = app('pragmarx.google2fa'); $result = $google2fa->verifyGoogle2FA($this->token, $value); return $result; } catch (Exception $e) { return false; } } /** * Get the validation error message. * * @return string */ public function message() { return 'Token provided is not valid'; } }