Password reset working locally

This commit is contained in:
Torsten 2017-08-25 12:57:58 +02:00
parent 11135e743c
commit 0abaeb2eba
23 changed files with 262 additions and 118 deletions

View file

@ -60,11 +60,9 @@ class RoundmailController extends Controller
$missingJokerMailList=array();
$adminMailList=array();
$topic="";
//TODO: umrüsten für Anzeige von Bestandsmails
$send_date = date("d.m.Y h:i:s", time());
$send_date = date("d.m.Y h:i:s", time());
Log::info("Users to check for missing tipps:" . sizeof($users));
foreach($users as $user) {
@ -120,7 +118,7 @@ class RoundmailController extends Controller
return view('roundmails.show',compact('mail_id','activeMailList','inactiveMailList','missingTippMailList','missingJokerMailList','adminMailList','send_date','user_id','topic', 'mail_message', 'recipients', 'sender_name','viewmode'));
return view('roundmails.show',compact('mail_id','activeMailList','inactiveMailList','missingTippMailList','missingJokerMailList','adminMailList','send_date','user_id','topic', 'mail_message', 'recipients', 'sender_name','viewmode'));
}
@ -148,84 +146,47 @@ class RoundmailController extends Controller
}
*/
$u = new User(['email'=>'magus@zauberturm.de','name'=>'Torsten der Schneider']);
$r = new RoundmailMailer();
$r->user_id = Auth::user()->id;
$r->send_date = Carbon\Carbon::now();
$r->recipients = request('recipients');
$r->topic = request('topic');
$r->mail_message = str_replace("\n","<br/>", request('message'));
// Die hier ist nur für die DB
$rm = new RoundMail();
$rm->send_date=$r->send_date;
$rm->recipients=$r->recipients;
$rm->user_id=$r->user_id;
$rm->topic=$r->topic;
$rm->message=$r->mail_message;
$rm->save();
$r = new RoundmailMailer();
$r->user_id = Auth::user()->id;
$r->send_date = Carbon\Carbon::now();
$r->recipients = request('recipients');
$r->topic = request('topic');
$r->mail_message = str_replace("\n","<br/>", request('message'));
\Mail::to(explode(",",$r->recipients))->send($r);
// Die hier ist nur für die DB
$rm = new RoundMail();
$rm->send_date=$r->send_date;
$rm->recipients=$r->recipients;
$rm->user_id=$r->user_id;
$rm->topic=$r->topic;
$rm->message=$r->mail_message;
$rm->save();
// TODO: refactor, loop is also used in index method.
// COPY/PASTE, please refactor!
$mails_db = Roundmail::all();
$mails=array();
foreach($mails_db as $mail_db) {
$fields=array();
$fields['id'] = $mail_db->id;
$fields['send_date'] = $mail_db->send_date;
$fields['topic'] = $mail_db->topic;
\Mail::to(explode(",",$r->recipients))->send($r);
// COPY/PAST, please replace !
$user_id=Auth::user()->id;
$users = DB::table('users')->where('deleted',null)->orderBy('lastname')->get();
$active_users=array();
$activeMailList=array();
$inactive_users=array();
$inactiveMailList=array();
$users_with_missing_tips=array(); // $users_with_missing_tips (or jokers)
$missingMailList=array();
$adminMailList=array();
$topic="";
//TODO: umrüsten für Anzeige von Bestandsmails
$maildate = date("d.m.Y h:i:s", time());
foreach($users as $user) {
if (User::is_season_paid($user->id)) {
array_push($active_users,$user);
array_push($activeMailList,$user->email);
} else {
array_push($inactive_users, $user);
array_push($inactiveMailList,$user->email);
}
if (User::hasMissingJoker($user->id) || User::hasMissingTipp($user->id)) {
array_push($users_with_missing_tips,$user);
array_push($missingMailList,$user->email);
}
if ($user->admin) {
array_push($adminMailList,$user->email);
}
$sender = User::where('id','=',$mail_db->user_id)->first();
$sender_name="(Gelöschter Anwender)";
if ($sender) { $sender_name=$sender->name; }
$fields['sender'] = $sender_name;
array_push($mails,$fields);
}
$mails=array_reverse($mails);
$activeMailList = implode(",",$activeMailList);
$inactiveMailList = implode(",",$inactiveMailList);
$missingMailList = implode(",",$missingMailList);
$adminMailList = implode(",",$adminMailList);
return view('roundmails.index',compact('mails'));
$round_id=-1;
return view('roundmails.show',compact('round_id','activeMailList','inactiveMailList','missingMailList','adminMailList','maildate','user_id','topic'));
}
}