コード例 #1
0
ファイル: Recover.php プロジェクト: robbytaylor/boom-core
 public function setPassword()
 {
     if ($this->request->method() === 'GET') {
         return $this->showForm(['token' => $this->request->input('token')]);
     }
     $person = Person::findByEmail($this->request->input('email'));
     if (!$person->isValid()) {
         return $this->showForm(['error' => Lang::get('boomcms::recover.errors.invalid_email'), 'token' => $this->request->input('token')]);
     }
     $tokens = $this->app['auth.password.tokens'];
     $token = $tokens->exists($person, $this->request->input('token'));
     if (!$token) {
         return $this->showForm(['error' => Lang::get('boomcms::recover.errors.invalid_token'), 'token' => $this->request->input('token')]);
     }
     if ($this->request->input('password1') != $this->request->input('password2')) {
         return $this->showForm(['error' => Lang::get('boomcms::recover.errors.password_mismatch'), 'token' => $this->request->input('token')]);
     }
     if ($this->request->input('password1') && $this->request->input('password2')) {
         $tokens->delete($token);
         $tokens->deleteExpired();
         $person->setEncryptedPassword($this->auth->hash($this->request->input('password1')));
         Person::save($person);
         $this->auth->login($person);
         return redirect('/');
     } else {
         return $this->showForm(['error' => Lang::get('boomcms::recover.errors.password_mismatch'), 'token' => $this->request->input('token')]);
     }
 }
コード例 #2
0
ファイル: CreatePerson.php プロジェクト: boomcms/boom-core
 /**
  * @return void
  */
 public function handle()
 {
     $password = (string) new RandomPassword();
     $hasher = new Hasher();
     try {
         $person = Person::create(['name' => $this->name, 'email' => $this->email, 'password' => $hasher->make($password)]);
     } catch (DuplicateEmailException $e) {
     }
     if (isset($person)) {
         Event::fire(new AccountCreated($person, $password, Auth::user()));
         return $person;
     } else {
         return Person::findByEmail($this->email);
     }
 }
コード例 #3
0
 /**
  * @return void
  */
 public function handle()
 {
     $password = (string) new RandomPassword();
     $this->credentials['password'] = Auth::hash($password);
     try {
         $person = Person::create($this->credentials);
     } catch (DuplicateEmailException $e) {
     }
     if (isset($person)) {
         foreach ($this->groups as $groupId) {
             $person->addGroup(Group::find($groupId));
         }
         Event::fire(new AccountCreated($person, $password, Auth::getPerson()));
         return $person;
     } else {
         return Person::findByEmail($this->credentials['email']);
     }
 }