Пример #1
0
 /**
  * Run the database seeding.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->truncate();
     $user = ['first_name' => 'CMS', 'last_name' => 'Admin', 'email' => '*****@*****.**', 'password' => 'password', 'activated' => 1, 'activated_at' => Carbon::now()];
     Credentials::getUserProvider()->create($user);
     $user = ['first_name' => 'CMS', 'last_name' => 'Semi-Admin', 'email' => '*****@*****.**', 'password' => 'password', 'activated' => 1, 'activated_at' => Carbon::now()];
     Credentials::getUserProvider()->create($user);
     $user = ['first_name' => 'CMS', 'last_name' => 'Moderator', 'email' => '*****@*****.**', 'password' => 'password', 'activated' => 1, 'activated_at' => Carbon::now()];
     Credentials::getUserProvider()->create($user);
     $user = ['first_name' => 'CMS', 'last_name' => 'Blogger', 'email' => '*****@*****.**', 'password' => 'password', 'activated' => 1, 'activated_at' => Carbon::now()];
     Credentials::getUserProvider()->create($user);
     $user = ['first_name' => 'CMS', 'last_name' => 'Editor', 'email' => '*****@*****.**', 'password' => 'password', 'activated' => 1, 'activated_at' => Carbon::now()];
     Credentials::getUserProvider()->create($user);
     $user = ['first_name' => 'CMS', 'last_name' => 'User', 'email' => '*****@*****.**', 'password' => 'password', 'activated' => 1, 'activated_at' => Carbon::now()];
     Credentials::getUserProvider()->create($user);
 }
Пример #2
0
 /**
  * Reset the user's password.
  *
  * @param int    $id
  * @param string $code
  *
  * @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
  *
  * @return \Illuminate\Http\Response
  */
 public function getPassword($id, $code)
 {
     if (!$id || !$code) {
         throw new BadRequestHttpException();
     }
     try {
         $user = Credentials::getUserProvider()->findById($id);
         $password = Str::random();
         if (!$user->attemptResetPassword($code, $password)) {
             return Redirect::to(Config::get('credentials.home', '/'))->with('error', 'There was a problem resetting your password. Please contact support.');
         }
         $mail = ['password' => $password, 'email' => $user->getLogin(), 'subject' => Config::get('app.name') . ' - New Password Information'];
         Mail::queue('credentials::emails.password', $mail, function ($message) use($mail) {
             $message->to($mail['email'])->subject($mail['subject']);
         });
         return Redirect::to(Config::get('credentials.home', '/'))->with('success', 'Your password has been changed. Check your email for the new password.');
     } catch (UserNotFoundException $e) {
         return Redirect::to(Config::get('credentials.home', '/'))->with('error', 'There was a problem resetting your password. Please contact support.');
     }
 }
Пример #3
0
 /**
  * Add the user by email to a group.
  *
  * @param string $email
  * @param string $group
  *
  * @return void
  */
 protected function matchUser($email, $group)
 {
     return Credentials::getUserProvider()->findByLogin($email)->addGroup(Credentials::getGroupProvider()->findByName($group));
 }
Пример #4
0
 /**
  * Queue the sending of the activation email.
  *
  * @return \Illuminate\Http\Response
  */
 public function postResend()
 {
     $input = Binput::only('email');
     $val = UserRepository::validate($input, array_keys($input));
     if ($val->fails()) {
         return Redirect::route('account.resend')->withInput()->withErrors($val->errors());
     }
     $this->throttler->hit();
     try {
         $user = Credentials::getUserProvider()->findByLogin($input['email']);
         if ($user->activated) {
             return Redirect::route('account.resend')->withInput()->with('error', 'That user is already activated.');
         }
         $code = $user->getActivationCode();
         $mail = ['url' => URL::to(Config::get('credentials.home', '/')), 'link' => URL::route('account.activate', ['id' => $user->id, 'code' => $code]), 'email' => $user->getLogin(), 'subject' => Config::get('app.name') . ' - Activation'];
         Mail::queue('credentials::emails.resend', $mail, function ($message) use($mail) {
             $message->to($mail['email'])->subject($mail['subject']);
         });
         return Redirect::route('account.resend')->with('success', 'Check your email for your new activation email.');
     } catch (UserNotFoundException $e) {
         return Redirect::route('account.resend')->with('error', 'That user does not exist.');
     }
 }