Change account notification settings.

@return \Illuminate\Http\RedirectResponse
5801
public function changeNotifications(Request $request)
    {
        $this->validate(
            $request,
            [
                'notifications' => 'required|array',
            ]
        );

        foreach ($request->input('notifications') as $notification => $enable) {
            Auth::user()->setNotification($notification, $enable);
        }

        Auth::user()->save();

        return redirect()->back()->withStatus(trans('mustard::account.notifications_changed'));
    }
479394
protected function secureEmailChange() {
    $this->defaultEmailChange();
    /** @var Token $token */
    $token = Yii::createObject([
      'class' => Token::className(),
      'userId' => $this->user->id,
      'type' => Token::TYPE_CONFIRM_OLD_EMAIL,
    ]);
    $token->save(false);
    $this->mailer->sendReconfirmationMessage($this->user, $token);

    // unset flags if they exist
    $this->user->flags &= ~User::NEW_EMAIL_CONFIRMED;
    $this->user->flags &= ~User::OLD_EMAIL_CONFIRMED;
    $this->user->save(false);

    Yii::$app->session->setFlash('info', Yii::t('users', 'We have sent confirmation links to both old and new email addresses. You must click both links to complete your request'));
  }
321537
public function postReset()
    {
        $input = Binput::only('email');

        $val = UserRepository::validate($input, array_keys($input));
        if ($val->fails()) {
            return Redirect::route('account.reset')->withInput()->withErrors($val->errors());
        }

        $this->throttler->hit();

        try {
            $user = Credentials::getUserProvider()->findByLogin($input['email']);

            $code = $user->getResetPasswordCode();

            $mail = [
                'link'    => URL::route('account.password', ['id'    => $user->id, 'code'    => $code]),
                'email'   => $user->getLogin(),
                'subject' => Config::get('app.name').' - Password Reset Confirmation',
            ];

            Mail::queue('credentials::emails.reset', $mail, function ($message) use ($mail) {
                $message->to($mail['email'])->subject($mail['subject']);
            });

            return Redirect::route('account.reset')
                ->with('success', 'Check your email for password reset information.');
        } catch (UserNotFoundException $e) {
            return Redirect::route('account.reset')
                ->with('error', 'That user does not exist.');
        }
    }
1047657
public function redirect()
    {
        $this->request->getSession()->set(
            'oauth.temp', $temp = $this->server->getTemporaryCredentials()
        );

        return new RedirectResponse($this->server->getAuthorizationUrl($temp));
    }
1178345
public function actionReadAll()
    {
        Notification::setReadAll(Yii::$app->user->id);
        Yii::$app->session->setFlash('success', Yii::t('notification', 'Successful operation.'));
        return $this->redirect(['index']);
    }
121379
public function profileChangePassword()
    {
        $user = Auth::user();

        $data = Input::all();

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

        $validator = Validator::make($data, $rules);

        if($validator->passes())
        {
            $user->fill($data);
            $user->save();

            //REDIRECCIONAR A PAGINA PARA VER DATOS
            return redirect()->route('admin.user.profile');
        }
        else
        {
            return Redirect::back()->withInput()->withErrors($validator->messages());
        }
    }
391150
public function authenticationStepAction()
    {
        $customer = $this->get('sonata.customer.selector')->get();

        $basket = $this->get('sonata.basket');
        $basket->setCustomer($customer);

        $this->get('sonata.basket.factory')->save($basket);

        return new RedirectResponse($this->generateUrl('sonata_basket_delivery_address'));
    }
727990
public function addNotificationSettings(UserNotificationSetting $notificationSetting)
    {
        $this->notificationSettings->set($notificationSetting->getName(), $notificationSetting);

        return $this;
    }
181204
public function setDefaultAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) {
            return $response;
        }

        $changeEvent = new CurrencyUpdateEvent((int) $this->getRequest()->get('currency_id', 0));

        // Create and dispatch the change event
        $changeEvent->setIsDefault(true)->setVisible(1);

        try {
            $this->dispatch(TheliaEvents::CURRENCY_SET_DEFAULT, $changeEvent);
        } catch (\Exception $ex) {
            // Any error
            return $this->errorPage($ex);
        }

        return $this->redirectToListTemplate();
    }
74386
public function actionChangePassword()
    {
        $model = new ChangePassword();
        if ($model->load(Yii::$app->getRequest()->post()) && $model->change()) {
            return $this->goHome();
        }

        return $this->render('change-password', [
                'model' => $model,
        ]);
    }
1279795
public function notifyUser()
    {
        switch ($this->type) {
            case self::TYPE_PASSWORD_RESET:
                $event = new PasswordReset;
                break;
            case self::TYPE_ACTIVATION:
                $event = new UserActivation;
                break;
            case self::TYPE_INVITATION:
                $event = new UserInvitation;
                break;
        }

        $this->user->notify($event);
    }
771793
public function postMail()
    {
        $config = Binput::get('config');

        execute(new UpdateConfigCommand($config));

        return cachet_redirect('dashboard.settings.mail')
            ->withInput(Binput::all())
            ->withSuccess(trans('dashboard.notifications.awesome'));
    }
692372
public function change()
    {
        $rolePermissionTable = $this->table('role_permission', ['signed' => false]);

        $rolePermissionTable->addColumn('role_id', 'integer', ['signed' => false])
            ->addColumn('permission_id', 'integer', ['signed' => false])
            ->addColumn('created_at', 'datetime')
            ->addIndex(['role_id', 'permission_id'], ['name' => 'idx_role_permission_unique', 'unique' => true])
            ->addForeignKey('role_id', 'role', 'id', ['delete' => 'RESTRICT', 'constraint' => 'fk_role_permission_role'])
            ->addForeignKey('permission_id', 'permission', 'id', ['delete' => 'RESTRICT', 'constraint' => 'fk_role_permission_permission'])
            ->create();
    }
234848
public function change()
    {
        $table = $this->table('permissions');
        
        $table->addColumn('owner_model', 'string', [
            'default' => null,
            'null' => false,
            'limit' => 50,
        ]);

        $table->removeColumn('user_id');
        $table->removeColumn('is_active');

        $table->addColumn('owner_foreign_key', 'char', [
            'default' => null,
            'null' => false,
            'limit' => 36 
        ]);

        $table->save();
    }
665140
public function activationEmail()
    {
        $this->loadModel('User.Users');
        $sent = false;

        if (!empty($this->request->data['username'])) {
            $user = $this->Users
                ->find()
                ->where([
                    'OR' => [
                        'username' => $this->request->data['username'],
                        'email' => $this->request->data['username'],
                    ],
                    'status' => 0
                ])
                ->limit(1)
                ->first();

            if ($user) {
                NotificationManager::welcome($user)->send();
                $this->Flash->success(__d('user', 'Instructions have been sent to your e-mail address.'), ['key' => 'activation_email']);
                $sent = true;
            } else {
                $this->Flash->danger(__d('user', 'No account was found matching the given username/email.'), ['key' => 'activation_email']);
            }
        }

        $this->title(__d('user', 'Activation Request'));
        $this->set(compact('sent'));
    }
247970
public function update(Request $request)
    {
        if ($request->has('notification')) {
            foreach ($request->notification as $id => $severity) {
                if (in_array(strtolower($severity), ['low', 'medium', 'high', 'disabled'])) {
                    Severity::where('id', $id)->update(['severity' => strtolower($severity)]);
                }
            }
        }

        return redirect(route('eyewitness.settings.index').'#severity')->withSuccess('The notification severity settings have been updated.');
    }
1179325
public function redirect()
    {
        if (!$this->isStateless()) {
            $this->request->getSession()->put(
                'oauth.temp', $temp = $this->server->getTemporaryCredentials()
            );
        } else {
            $temp = $this->server->getTemporaryCredentials();
            $this->request->session()->put('oauth_temp', serialize($temp));
        }

        return new RedirectResponse($this->server->getAuthorizationUrl($temp));
    }