public function userHasLoggedIn($user)
 {
     //Session::flash(): store items in the session only for the next request.
     \Session::flash('message', 'Welcome, ' . $user->name);
     \Flash::message(\Session::get('message'));
     return redirect('/home');
 }
예제 #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $status = Status::find($id);
     $status->delete();
     Flash::message('Your status has been removed.');
     return Redirect::back();
 }
예제 #3
0
 public function destroy($id)
 {
     $status = Comment::find($id);
     $status->delete();
     Flash::message('Your comment has been deleted.');
     return Redirect::back();
 }
예제 #4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     $formPost = FormPost::findOrFail($id);
     $formPost->delete();
     Flash::message('Post was successfully deleted');
     return langRedirectRoute('admin.form-post.index');
 }
예제 #5
0
 /**
  * Save a new status
  *
  * @return Response
  */
 public function store()
 {
     $this->publishStatusForm->validate(Input::only('body'));
     $this->execute(new PublishStatusCommand(Input::get('body'), Auth::user()->id));
     Flash::message('Your status has been updated!');
     return Redirect::refresh();
 }
예제 #6
0
 /**
  * Save a new status
  *
  * @return Response
  */
 public function store()
 {
     $input = array_add(Input::get(), 'userId', Auth::id());
     $this->publishStatusForm->validate($input);
     $this->execute(PublishStatusCommand::class, $input);
     Flash::message('Your status has been updated!');
     return Redirect::back();
 }
예제 #7
0
 /**
  * Create a new Larabook user.
  *
  * @return string
  */
 public function store()
 {
     $this->_registrationForm->validate(Input::all());
     $user = $this->execute(RegisterUserCommand::class);
     Auth::login($user);
     Flash::message('Glad to have you as a new Larabook member!');
     return Redirect::home();
 }
 public function generate(GeneratorRequest $request, $generator)
 {
     $result = $this->command->call($generator, $this->generatorMap, $request);
     if ($result) {
         \Flash::message(str_replace("\n", '<br>', $result['output']), $result['level']);
     }
     return redirect()->back();
 }
예제 #9
0
 /**
  * Update the specified resource in storage.
  * PUT /profile/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function postEdit()
 {
     $id = Auth::user()->id;
     $user = User::findOrFail($id);
     $user->fill(Input::all());
     $user->save();
     Flash::message('User Updated!');
     return Redirect::route('profile.edit');
 }
예제 #10
0
 public function redirect_to($url, $flash = NULL)
 {
     if ($url instanceof ORM) {
         $url = Route::url_for($url);
     }
     if ($flash !== NULL) {
         Flash::message($flash);
     }
     $this->redirect($url);
 }
예제 #11
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::get();
     $input['userId'] = Auth::id();
     $this->publishStatusForm->validate($input);
     //we can explicity pull throw an $input, have a look at CommanderTrait.php
     $this->execute(PublishStatusCommand::class, $input);
     Flash::message('Your status has been updated!');
     return Redirect::back();
 }
예제 #12
0
 /**
  * Handle a POST request to remind a user of their password.
  *
  * @return Response
  */
 public function postRemind()
 {
     switch ($response = Password::remind(Input::only('email'))) {
         case Password::INVALID_USER:
             Flash::error(Lang::get($response));
             return Redirect::back();
         case Password::REMINDER_SENT:
             Flash::message(Lang::get($response));
             return Redirect::back();
     }
 }
예제 #13
0
 public function store()
 {
     $formData = Input::only('email', 'password');
     $this->signInForm->validate($formData);
     if (!Auth::attempt($formData)) {
         Flash::message('We were unable to sign you in. Please check your credentials and try again!');
         return Redirect::back()->withInput();
     }
     Flash::message('Welcome back!');
     return Redirect::intended('home');
 }
예제 #14
0
 /**
  * Save a new status
  *
  * @return Response
  */
 public function store()
 {
     //        $input = Input::get();
     //        $input['userId'] = Auth::id();
     $input = array_add(Input::get(), 'userId', Auth::id());
     $this->publishStatusForm->validate($input);
     $this->execute(PublishStatusCommand::class, $input);
     //        $status = $this->execute(new PublishStatusCommand(Input::get('body'), Auth::user()->id));
     Flash::message('Your status has been updated');
     return Redirect::back();
 }
 public function send(Request $request)
 {
     //dd(Input::all);
     //TODO: SEND EMAIL
     //FLASH NOTIFICATION
     //        $request->session()->flash(
     //            'notification',
     //            'All ok!'
     //        );
     Flash::message('Ok!');
     //REDIRECT WELCOME
     return redirect()->route('welcome');
 }
 public function checkIfUserNeedsUpdating($userData, $user)
 {
     $socialData = ['avatar' => $userData->avatar, 'email' => $userData->email, 'name' => $userData->name, 'username' => $userData->nickname];
     $dbData = ['avatar' => $user->avatar, 'email' => $user->email, 'name' => $user->name, 'username' => $user->username];
     if (!empty(array_diff($socialData, $dbData))) {
         $user->avatar = $userData->avatar;
         $user->email = $userData->email;
         $user->name = $userData->name;
         $user->username = $userData->nickname;
         $user->save();
         \Flash::message('User updated!');
     }
 }
예제 #17
0
 /**
  * Store a newly created resource in storage.
  * POST /contacts
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::get();
     $this->contactForm->validate($input);
     Message::create($input);
     Flash::message('Бидэнтэй холбогдож байгаад баярлалаа. Таньд удахгүй хариу мэдэгдье!');
     Mail::send('emails.question', $input, function ($message) {
         $message->to('*****@*****.**')->subject('Ask Ganbaatar');
     });
     Mail::send('emails.question', $input, function ($message) {
         $message->to('*****@*****.**')->subject('Ask Ganbaatar');
     });
     return Redirect::back();
 }
 /**
  * Attempt to log a user in
  * POST /sessions
  *
  * @return Response
  */
 public function store()
 {
     $rules = ['username' => 'required|exists:users', 'password' => 'required'];
     $validator = Validator::make(Input::only('username', 'email', 'password'), $rules);
     if ($validator->fails()) {
         return Redirect::back()->withInput()->withErrors($validator);
     }
     $credentials = ['username' => Input::get('username'), 'password' => Input::get('password'), 'confirmed' => 1];
     if (!Auth::attempt($credentials)) {
         return Redirect::back()->withInput()->withErrors(['credentials' => 'We were unable to sign you in']);
     }
     Flash::message('Welcome back!');
     return Redirect::home();
 }
예제 #19
0
 /**
  * Handle a POST request to remind a user of their password.
  *
  * @return Response
  */
 public function postRemind()
 {
     $response = Password::remind(Input::only('email'), function ($message) {
         $message->subject('Password Reminder');
     });
     switch ($response) {
         case Password::INVALID_USER:
             Flash::error(Lang::get($response));
             return Redirect::back()->with('error', Lang::get($response));
         case Password::REMINDER_SENT:
             Flash::message(Lang::get($response));
             return Redirect::back()->with('status', Lang::get($response));
     }
 }
 public function send(Request $request)
 {
     //dd(Input::all());
     //        $request->session()->flash(
     //            'flash_message',
     //            'All ok!'
     //        );
     $this->sendEmail();
     Flash::message("Ok!");
     //        $flash = app('\App\Http\Flash');
     //
     //        $flash->message("ok");
     return redirect()->route('welcome');
 }
 public function confirm($confirmation_code)
 {
     if (!$confirmation_code) {
         throw new InvalidConfirmationCodeException();
     }
     $user = User::whereConfirmationCode($confirmation_code)->first();
     if (!$user) {
         throw new InvalidConfirmationCodeException();
     }
     $user->confirmed = 1;
     $user->confirmation_code = null;
     $user->save();
     Flash::message('You have successfully verified your account.');
     return Redirect::route('login_path');
 }
예제 #22
0
 /**
  * Handle a POST request to reset a user's password.
  *
  * @return Response
  */
 public function postReset()
 {
     $credentials = Input::only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $user->password = $password;
         $user->save();
     });
     switch ($response) {
         case Password::INVALID_PASSWORD:
         case Password::INVALID_TOKEN:
         case Password::INVALID_USER:
             Flash::error(Lang::trans('messages.' . $response));
             return Redirect::back();
         case Password::PASSWORD_RESET:
             Flash::message(Lang::trans('messages.' . $response));
             return Redirect::to('auth/login');
     }
 }
 /**
  * Send a reset link to the given user.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function sendResetLinkEmail(Request $request)
 {
     $this->validate($request, ['email' => 'required|email']);
     $viewData = new \stdClass();
     $viewData->title = trans('email.password_reset.title');
     $viewData->subject = $this->getEmailSubject();
     $response = Password::sendResetEmail($request->only('email'), $viewData, function (Message $message) {
         $message->subject($this->getEmailSubject());
     });
     switch ($response) {
         case PasswordBroker::RESET_LINK_SENT:
             \Flash::message(trans($response));
             return redirect()->to(route('home'));
         case PasswordBroker::INVALID_USER:
             return redirect()->back()->withErrors(['email' => trans($response)]);
     }
     return null;
 }
예제 #24
0
 /**
  * Log a user out of Larabook.
  *
  * @return mixed
  */
 public function destroy()
 {
     Auth::logout();
     Flash::message('You have now been logged out.');
     return Redirect::home();
 }
예제 #25
0
 public function refreshCache($id)
 {
     $user = User::findOrFail($id);
     $user_info = (new GithubUserDataReader())->getDataFromUserName($user->github_name);
     // Refresh the GitHub card proxy cache.
     $cache_name = 'github_api_proxy_user_' . $user->github_name;
     Cache::put($cache_name, $user_info, 1440);
     // Refresh the avatar cache.
     $user->image_url = $user_info['avatar_url'];
     $user->cacheAvatar();
     $user->save();
     Flash::message(lang('Refresh cache success'));
     return Redirect::route('users.edit', $id);
 }
 /**
  * @param Request $request
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  * @throws AuthorizationException
  */
 public function activate($token, $source)
 {
     if (strlen($token) == 64 && strlen($source) > 200) {
         try {
             $response = \UserActivation::activate($token, decrypt($source), function ($user) {
                 \Sentinel::getUserProvider()->activateUser($user);
             });
         } catch (DecryptException $e) {
             throw new AuthorizationException();
         }
         switch ($response) {
             case UserActivation::ACTIVATION_DONE:
                 \Flash::message(trans($response));
                 break;
             case UserActivation::INVALID_USER:
                 \Flash::error(trans($response));
                 break;
             case UserActivation::INVALID_TOKEN:
                 \Flash::error(trans($response));
                 break;
         }
     } else {
         throw new AuthorizationException();
     }
     return \Redirect()->to(route('home'));
 }
예제 #27
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/', function () {
    return View::make('pages.index');
});
Route::get('/flash', function () {
    Flash::message('Test');
    return Redirect::to('/');
});
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Project::findOrFail($id)->delete();
     Flash::message('Project Deleted!');
     return Redirect::route('projects')->with('Flash_message', 'Project Deleted');
 }
예제 #29
0
파일: Admin.php 프로젝트: eadz/chyrp
 /**
  * Function: theme
  * Changes the admin theme.
  */
 public function change_admin_theme()
 {
     if (empty($_GET['theme'])) {
         error(__("No Theme Specified"), __("You did not specify a theme to switch to."));
     }
     $config = Config::current();
     $_SESSION['admin_theme'] = $_GET['theme'];
     if (file_exists(ADMIN_THEMES_DIR . "/" . $_GET['theme'] . "/locale/" . $config->locale . ".mo")) {
         load_translator($_GET['theme'], ADMIN_THEMES_DIR . "/" . $_GET['theme'] . "/locale/" . $config->locale . ".mo");
     }
     $info = YAML::load(ADMIN_THEMES_DIR . "/" . $_GET['theme'] . "/info.yaml");
     fallback($info["notifications"], array());
     foreach ($info["notifications"] as &$notification) {
         $notification = __($notification, $_GET['theme']);
     }
     foreach ($info["notifications"] as $message) {
         Flash::message($message);
     }
     # Clear the caches made by the previous theme.
     foreach (glob(INCLUDES_DIR . "/caches/*.cache") as $cache) {
         @unlink($cache);
     }
     Flash::notice(_f("Admin theme changed to &#8220;%s&#8221;.", array($info["name"])), "/admin/?action=themes");
 }
예제 #30
0
 public function logout()
 {
     Auth::logout();
     Flash::message('You are now logged out.');
     return Redirect::to('/');
 }