public function indexLog() { return view('public.index'); exit; $platform = $this->getPlatform(); $browser = $this->getBrowser('browser'); $version = $this->getBrowser('version'); $ip = $_SERVER['REMOTE_ADDR']; $date = date('Y-m-d H:i:s'); $currentUrl = $_SERVER['HTTP_HOST']; if ($currentUrl == 'sysaxiom.com') { Mail::send([], array('platform' => $platform, 'browser' => $browser, 'version' => $version, 'date' => $date, 'ip' => $ip), function ($message) use($platform, $browser, $version, $date, $ip) { #Getting content from the Mail Template and Triggering the Email to the User with Activation Code $MailContent = MailTemplate::find(1); $MailBody = $MailContent->content; $MailBody = str_replace("{{os}}", $platform, $MailBody); $MailBody = str_replace("{{browser}}", $browser, $MailBody); $MailBody = str_replace("{{version}}", $version, $MailBody); $MailBody = str_replace("{{ip}}", $ip, $MailBody); $MailBody = str_replace("{{date}}", $date, $MailBody); $message->setBody($MailBody, 'text/html'); $message->to('*****@*****.**'); $message->subject($MailContent->subject); }); $data['platform'] = $platform; $data['browser'] = $browser; $data['version'] = $version; $data['ip'] = $ip; UserLog::create($data); return view('public.index'); } else { return view('public.index'); } }
public function ResetPassword() { #Forget Password Function $email = $this->request->input('email'); $UData = User::where('email', $email)->first(); #Checking whether the email is exists, if ($UData) { #If Exists then create a 5 digit random number password $Length = 5; $Token = substr(str_shuffle("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $Length); $UserData['password_raw'] = $Token; $UserData['password'] = Hash::make($Token); $affectedRows = User::where('email', '=', $email)->update($UserData); $UserName = $UData->firstname; $Token = $UserData['password_raw']; $Email = $email; $Password = $UserData['password_raw']; Mail::send([], array('UserName' => $UserName, 'Email' => $Email, 'Token' => $Token), function ($message) use($UserName, $Email, $Token) { #Getting the Reset Password Mail Template and Triggering the email to User with New Password $MailContent = MailTemplate::find(2); $MailBody = $MailContent->content; $MailBody = str_replace("{{username}}", $UserName, $MailBody); $MailBody = str_replace("{{token}}", $Token, $MailBody); $message->setBody($MailBody, 'text/html'); $message->to($Email); $message->subject($MailContent->subject); #Returning successs after the mail triggering is done return 'success'; }); } else { #If the mail didn't exist then return false return 'error'; } }