mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-01-31 00:09:39 -06:00
The Laravel framework adopts the PSR-2 coding style in version 5.1. Laravel apps *should* adopt this coding style as well. Read the [PSR-2 coding style guide][1] for more details and check out [PHPCS][2] to use as a code formatting tool. [1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md [2]: https://github.com/squizlabs/PHP_CodeSniffer
40 lines
951 B
PHP
Executable File
40 lines
951 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Controllers\Auth;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\UserActivation;
|
|
use Illuminate\Foundation\Auth\ResetsPasswords;
|
|
use Illuminate\Support\Str;
|
|
|
|
class ResetPasswordController extends Controller
|
|
{
|
|
use ResetsPasswords;
|
|
|
|
protected $redirectTo = '/';
|
|
protected $group_id = 3;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->middleware('guest');
|
|
}
|
|
|
|
protected function resetPassword($user, $password)
|
|
{
|
|
$user->password = bcrypt($password);
|
|
$user->remember_token = Str::random(60);
|
|
if ($user->group_id === 1) {
|
|
$user->group_id = $this->group_id;
|
|
}
|
|
$user->active = true;
|
|
$user->save();
|
|
|
|
// Activity Log
|
|
\LogActivity::addToLog("Member " . $user->username . " has successfully reset his/her password.");
|
|
|
|
UserActivation::where('user_id', $user->id)->delete();
|
|
|
|
$this->guard()->login($user);
|
|
}
|
|
}
|