Files
UNIT3D-Community-Edition/app/Http/Controllers/Auth/ForgotPasswordController.php
Morgan Wong e1ee8261d9 (Update) Add captcha support
Overriding function validateEmail with captcha condition
2019-05-05 17:34:19 +08:00

44 lines
1.0 KiB
PHP
Executable File

<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D
*
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
* @author HDVinnie
*/
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
class ForgotPasswordController extends Controller
{
use SendsPasswordResetEmails;
public function __construct()
{
$this->middleware('guest');
}
protected function validateEmail(Request $request)
{
if (config('captcha.enabled') == false) {
$request->validate(['email' => 'required|email']);
}
else{
$request->validate([
'email' => 'required|email',
'g-recaptcha-response' => 'required|recaptcha',
]);
}
}
}