Change password form processing page.

@param  int      $id
@return Redirect
170247
public function postChangePassword()
    {
        $user = Sentinel::getUser();

        $validation = array(
            'password'         => 'required|between:3,32',
            'password_confirm' => 'required|same:password',
        );

        // Create a new validator instance from our validation rules
        $validator = Validator::make(Input::all(), $validation);

        // If validation fails, we'll exit the operation now.
        if ($validator->fails()) {
            // Ooops.. something went wrong
            return Redirect::back()->withInput()->withErrors($validator);
        }

        try {
            // Do we want to update the user password?
            $password = Input::get('password');

            if (Sentinel::validateCredentials($user, [ 'email' => $user->email, 'password' => Input::get('old-password')]))
            {
                $user->password = Hash::make($password);
                $redirect = 'change-password';

                if ($user->force_new_password)
                {
                    $user->force_new_password = 0;
                    $redirect = 'home';
                }

                // Was the user updated?
                if ($user->save())
                {
                    // Prepare the success message
                    $success = Lang::get('base.auth.account.changed');

                    Mail::queue('emails.account.password-changed', [ 'user' => $user ], function ($m) use ($user) {
                        $m->to($user->email, $user->first_name . ' ' . $user->last_name);
                        $m->subject(Lang::get('base.mails.password_changed'));
                    });

                    Base::Log($user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') changed its password account. ');

                    // Redirect to the user page
                    return Redirect::route($redirect)->with('success', $success);
                }
            }
            else
            {
                $error = Lang::get('base.auth.wrong_password');
                $validator->messages()->add('old-password', Lang::get('base.auth.wrong_password'));

                // Redirect to the user page
                return Redirect::route('change-password')->withInput()->withErrors($validator)->with('error', $error);
            }

            // Prepare the error message
        } catch (Exception $e) {
        }
        $error = Lang::get('base.base.error');


        // Redirect to the user page
        return Redirect::route('change-password')->withInput()->with('error', $error);
    }
392113
public function edit($id)
    {
        try {
            $user = $this->repository->findById($id);

            $role = $user->roles->lists('id');

            return $this->view('users.edit', compact('user', 'role'));
        } catch (ModelNotFoundException $e) {
            return $this->redirectNotFound();
        }
    }
736334
public function edit($id): Content
    {
        return Admin::content(function (Content $content) use ($id) {
            $content->header($this->title());

            $content->body($this->form($id)->edit($id));
        });
    }
30260
public function editAction($id)
    {
        $instance = $this->getManager()->find($id);
        if(!$instance) {
            return new RedirectResponse($this->generateUrl('ringo_php_redmon'));
        }
        $form = $this->getForm($instance);
        return $this->render(
            $this->getTemplatePath().'edit.html.twig',
            array(
                'form' => $form->createView(),
                'id'   => $id,
                'errors' => array()
            )
        );
    }
1067056
public function edit($id)
    {
      if ( \Auth::user()->roles[0]->can('menu-update' ) ) {
        $menu = $this->menus->findOrFail($id);
        $items = $this->menus->pluck('name', 'id')->toarray();
        $roles = Role::lists('name', 'id')->toarray();
        $selected = $menu->roles->pluck('id')->toarray();
        return view('admin.menus.edit', compact('menu', 'selected', 'roles', 'items'));
      }
      return \Redirect::route('admin.menus.index')->withErrors(trans('acl::dashboard.unauthorized_access'));

    }
1271644
public function actionDelete($id)
    {
        $this->findModel($id)->delete();
        Yii::$app->getSession()->setFlash('success', Yii::t('system', 'Delete success.'));
        return $this->redirect(['index']);
    }
907846
public function switchToUser($id)
    {
        if ($this->service->switchToUser($id)) {
            return redirect('dashboard')->with('message', 'You\'ve switched users.');
        }

        return redirect('dashboard')->with('errors', ['Could not switch users']);
    }
1365968
public function actionDelete($id)
    {
        $date = new DateTime('now');
        $model = $this->findModel($id);
        $model->deleted_at = $date->format("U");
        $model->save();

        return $this->redirect(['index']);
    }
550857
public function edit($id)
    {
        if (!$role = $this->roleRepositoryInterface->getById($id)) {
            Flash::error(trans('dashboard::dashboard.errors.role.found'));

            return redirect()->route('roles.index');
        }

        $permissions = $this->permissionRepositoryInterface->getAll();

        return $this->view('roles.edit')->with(['role' => $role, 'permissions' => $permissions]);
    }
1193213
public function setHandler($id)
    {
        if (is_string($id)) {
            $this->handler = $this->file->getHandler($id);
        } else {
            $this->handler = $id;
        }

        return $this;
    }
645037
public function edit($id)
    {
        $admin = $this->adminRepository->find($id);

        if (is_null($admin)) {
            return Redirect::route('admin.admin.index');
        }

        $authorizes = $this->adminPermissionRepository->authorizes;

        return view('admin::admin.edit')
            ->with('admin', $admin)
            ->with('authorizes', $authorizes);
    }
203441
public function actionDelete($id)
    {
        $this->findModel($id)->delete();
        Helper::invalidate();

        return $this->redirect(['index']);
    }
539738
public function actionDeleteLanguage($id)
    {
        $model = $this->findLanguageModel($id);
        $model->delete();
        return $this->redirect(['edit', 'id' => $model->context_id]);
    }
774296
public function updatePassword($id, Request $request)
    {
        $user = User::findOrFail($id);

        $rules = [
            'password' => 'required|confirmed',
            'password_confirmation' => 'required'
        ];

        $this->validate($request, $rules);

        $user->fill($request->all());
        $user->save();

        //MENSAJE
        flash()->success('La contraseña se modificó satisfactoriamente.');

        //REDIRECCIONAR A PAGINA PARA VER DATOS
        return redirect()->route('admin.user.index');
    }
280885
public function actionUpdate($id)
    {
        $model = $this->findModel($id);
        $model->setScenario('update');
        if($model->load(Yii::$app->request->post())){
            if($model->password){
                $model->setPassword($model->password);
                $model->generateAuthKey();
            }

            if ($model->save()) {
                //MenuHelper::invalidate();
                return $this->redirect(['index']);
            } else {
                return $this->render('update', [
                    'model' => $model,
                ]);
            }
        }else{
            return $this->render('update', [
                'model' => $model,
            ]);
        }


    }
485095
private function _login($id){
    if ( $this->check() && $id ){
      $this
        ->_authenticate($id)
        ->_user_info()
        ->_init_dir(true)
        ->save_session();
    }
    return $this;
  }
806405
public function actionDelete($id)
    {
        if (Yii::$app->request->isPost) {
            $this->findModel($id)->delete();
        }
        return $this->redirect(['index']);
    }