Last version before the auth-pocalypse

This commit is contained in:
Torsten 2017-08-24 17:45:30 +02:00
parent 70e28110cb
commit 11135e743c
11 changed files with 334 additions and 14 deletions

View file

@ -12,6 +12,14 @@ use App\Tipp;
use App\Quota;
use App\Mail\RoundmailMailer;
use Password;
use Illuminate\Contracts\Auth\Guard;
//use Illuminate\Contracts\Auth\PasswordBroker;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Auth\Passwords\PasswordBroker;
use DB;
use Auth;
use Log;
@ -21,14 +29,11 @@ use Carbon;
class UsersController extends Controller
{
public function main() {
$currentSeason=Season::getCurrent();
$roundname="";
$report="";
$result=User::hasMissingJoker(1);
Log::info("!!! =>".$result);
if (!$result) { Log::info("Joker is missing");}
$currentSeason=Season::getCurrent();
// display_rounds berechnen für Nav und Rundenberichte
$display_rounds=array();
if ($currentSeason) {
$round_id = Round::getLastCompleteRoundId();
@ -47,7 +52,23 @@ class UsersController extends Controller
} else { Log::info("No round identified. Last Locked=".$round_id); $report="";}
} else {Log::info("No current season");}
return view('main',compact('roundname','display_rounds'));
$nextRoundName="";
$nextRoundId = Round::getFirstIncompleteRound();
if ($nextRoundId>-1) { $nextRoundName = Round::where('id','=',$nextRoundId)->first()->name; }
$user=Auth::user();
$message_text_tipps="";
$message_text_joker="";
if ($user && $currentSeason) {
if (User::hasMissingTipp($user->id)) {
$message_text_tipps="Fehlende Tipps für ".$nextRoundName;
}
if (User::hasMissingJoker($user->id)) {
$message_text_joker="Fehlender Joker für ".$nextRoundName;
}
}
return view('main',compact('roundname','display_rounds','message_text_joker','message_text_tipps','nextRoundName'));
}
public function index() {
@ -444,4 +465,28 @@ class UsersController extends Controller
}
public function test() {
//Password::sendResetLink(['email','magus@zauberturm.de']);
$request = new Request();
$request->merge(['email'=>'magus@zauberturm.de']);
$broker = $this->getBroker();
$response = Password::broker($broker)->sendResetLink($request->only('email'), function (Message $message) {
$message->subject($this->getEmailSubject());
});
}
// App\Http\Controllers\Auth\ForgotPasswordController@sendResetLinkEmail
public function reset() {
return view('auth.passwords.email');
}
public function processReset(Request $request) {
$response = $this->broker()->sendResetLink(
$request->only('email')
);
}
}