Resend the validation code triggered by user.

@return \Illuminate\Http\Response
969366
public function resend()
    {
        if (!config('laravel2step.laravel2stepEnabled')) {
            abort(404);
        }

        $twoStepAuth = $this->_twoStepAuth;
        $this->sendVerificationCodeNotification($twoStepAuth);

        $returnData = [
            'title'   => trans('laravel2step::laravel-verification.verificationEmailSuccess'),
            'message' => trans('laravel2step::laravel-verification.verificationEmailSentMsg'),
        ];

        return response()->json($returnData, 200);
    }
1198100
public function recover()
    {
        $validator = ValidatorFacade::make([], []);

        foreach ($this->messages as $key => $value) {
            foreach (Arr::wrap($value) as $message) {
                $validator->errors()->add($key, $message);
            }
        }

        return $validator;
    }
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.');
        }
    }
119741
public function validate()
    {
        $setToBreak = false;

        foreach ($this->_validations as $v) {
            foreach ($v['fields'] as $field) {
                if (isset($this->_skips[$field])) {
                    if ($this->_skips[$field] === self::SKIP_ALL) {
                        break 2;
                    }

                    if ($this->_skips[$field] === self::SKIP_ONE) {
                        break;
                    }
                }

                [$values, $multiple] = $this->getPart($this->_fields, \explode('.', $field));

                // Don't validate if the field is not required and the value is empty
                if (null !== $values && $this->hasRule('optional', $field)) {
                    //Continue with execution below if statement
                } elseif (
                    $v['rule'] !== 'accepted' &&
                    $v['rule'] !== 'required' && !$this->hasRule('required', $field) &&
                    (null === $values || $values === '' || ($multiple && \count($values) === 0))
                ) {
                    continue;
                }

                // Callback is user-specified or assumed method on class
                $errors = $this->getRules();
                if (isset($errors[$v['rule']])) {
                    $callback = $errors[$v['rule']];
                } else {
                    $callback = [$this, 'validate' . \ucfirst($v['rule'])];
                }

                if (!$multiple) {
                    $values = [$values];
                }

                $result = true;
                foreach ($values as $value) {
                    $result = $result && $callback($field, $value, $v['params'], $this->_fields);
                }

                if (!$result) {
                    $this->error($field, $v['message'], $v['params']);
                    if ($this->stopOnFirstFail) {
                        $setToBreak = true;
                        break;
                    }
                    $this->_skips[$field] = $v['skip'];
                }
            }

            if ($setToBreak) {
                break;
            }
        }

        return \count($this->errors()) === 0;
    }
246295
public function validate($removeRequired = false)
    {
        if ($removeRequired) {
            $this->removeRequired();
        }
        $content = $this->request->all();
        $messages = (method_exists($this, 'messages') && is_array($this->messages())) ? array_merge($this->messages, $this->messages()) : $this->messages;
        $this->validator = $this->app['validator']->make($content, $this->getRules(), $messages);
        /** get iterable keys and iterate */
        $mappings = $this->mappings();
        foreach ($mappings as $key => $value) {
            if (is_array($value) && class_exists($value['class']) && array_get($content, $key)) {
                $class = new $value['class']($this->app);
                $messages = (method_exists($class, 'messages') && is_array($class->messages())) ? array_merge($this->messages, $class->messages()) : $this->messages;
                $this->validator->iterate($this->request, $key, $class, $messages);
            }
        }

        if (method_exists($this, 'getSometimes')) {
            call_user_func_array([$this, 'getSometimes'], [$this->validator]);
        }

        if ($this->validator->fails()) {
            throw new ValidationException($this->validator->errors());
            
        }

        return $this->getDbValues($this->validator->getData(), $this->mappings());
    }
1104119
public function store()
    {
        $data = Input::all();

        // Handle validation errors.
        if ($validationMessages = $this->validationMessages($data)) {
            return back()->withInput()->withErrors($validationMessages);
        }

        if (($response = $this->prepare($data)) instanceof Response) {
            return $response;
        }

        DB::transaction(function () {
            $inserts = $this->prepareInsert($this->updates);

            foreach ($inserts as $column => $value) {
                $this->model->setAttribute($column, $value);
            }

            $this->model->save();

            $this->updateRelation($this->relations);
        });

        if (($response = $this->complete($this->saved)) instanceof Response) {
            return $response;
        }

        if ($response = $this->ajaxResponse(trans('admin.save_succeeded'))) {
            return $response;
        }

        return $this->redirectAfterStore();
    }
740438
protected function validateDownload()
    {
        $this->setSubmitted('download');
        $this->setSubmittedArray('sources');
        $this->validateElement('sources', 'required');
        $this->validateUrlDownload();

        return !$this->hasErrors();
    }
57281
public function actionSend()
    {
        $model = new MessageSendForm();
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['index']);
        }
        return $this->render('send', ['model' => $model]);
    }
333336
public function validate()
    {
        $isSubmitted = false;
        foreach ($this->datasources as $ds) {
            if ($ds instanceof HTML_QuickForm2_DataSource_Submit) {
                $isSubmitted = true;
                break;
            }
        }
        return $isSubmitted? parent::validate(): false;
    }
153822
public function validation()
    {
        $validator = new Validation();
        $validator->add(
            'email',
            new Email([
                'field' => 'email',
                'required' => true,
            ])
        );

        $validator->add(
            'displayname',
            new PresenceOf([
                'field' => 'displayname',
                'required' => true,
            ])
        );

        $validator->add(
            'displayname',
            new Regex([
                'field' => 'displayname',
                'message' => _('Please use alphanumerics only.'),
                'pattern' => '/^[A-Za-z0-9_.-]{1,16}$/',
            ])
        );

        // Unique values
        $validator->add(
            'email',
            new Uniqueness([
                'field' => 'email',
                'message' => _('This email already has an account.'),
            ])
        );

        $validator->add(
            'displayname',
            new Uniqueness([
                'field' => 'displayname',
                'message' => _('The username is already taken.'),
            ])
        );

        return $this->validate($validator);
    }
147910
protected function addValidateMethod()
    {
        $table = $this->getTable();
        $foreignKeys = $table->getForeignKeys();
        $hasForeignKeys = (count($foreignKeys) != 0);
        $aVarNames = [];
        $refFkVarNames = [];
        $collVarNames = [];

        if ($hasForeignKeys) {
            foreach ($foreignKeys as $fk) {
                $aVarNames[] = $this->builder->getFKVarName($fk);
            }
        }

        foreach ($table->getReferrers() as $refFK) {
            if ($refFK->isLocalPrimaryKey()) {
                $refFkVarNames[] = $this->builder->getPKRefFKVarName($refFK);
            } else {
                $collVarNames[] = $this->builder->getRefFKCollVarName($refFK);
            }
        }

        return $this->renderTemplate('objectValidate', [
            'hasForeignKeys' => $hasForeignKeys,
            'aVarNames'      => $aVarNames,
            'refFkVarNames'  => $refFkVarNames,
            'collVarNames'   => $collVarNames
        ]);
    }
550788
public function validate() {
        $status = new ValidationResult();

        // Check if the form is loaded
        if (!$this->form instanceof \bootbuilder\Form) {
            $status->setError(true);
            return $status;
        }

        // Validate form controls (and panes)
        foreach ($this->form->getRawControls() as $nr => $control) {
            if(!$this->validateControl($control, $status)) {
                $status->setError(true);
                $control->setErrorState(true);
            }
            
            $this->form->replaceControl($nr, $control);
        }
        
        return $status;
    }
408457
public function resend(Request $request)
    {
        if ($request->user()->hasVerifiedEmail()) {
            return redirect($this->redirectPath());
        }

        $request->user()->sendEmailVerificationNotification();

        return back()->with('resent', true);
    }
593886
public function resend()
    {
        if (!userHasPermission('admin:email:email:resend')) {
            unauthorised();
        }

        // --------------------------------------------------------------------------

        $oEmailer = Factory::service('Emailer', 'nails/module-email');

        // --------------------------------------------------------------------------

        $oUri     = Factory::service('Uri');
        $iEmailId = $oUri->segment(5);
        $sReturn  = $this->input->get('return') ? $this->input->get('return') : 'admin/email/index';

        if ($oEmailer->resend($iEmailId)) {
            $sStatus  = 'success';
            $sMessage = 'Message was resent successfully.';
        } else {
            $sStatus  = 'error';
            $sMessage = 'Message failed to resend. ' . $oEmailer->lastError();
        }

        $oSession = Factory::service('Session', 'nails/module-auth');
        $oSession->setFlashData($sStatus, $sMessage);
        redirect($sReturn);
    }
1342803
def _update_validation_response(error, response):
        """"""
        new_response = response.copy()

        # El status del catálogo entero será ERROR
        new_response["status"] = "ERROR"

        # Adapto la información del ValidationError recibido a los fines
        # del validador de DataJsons
        error_info = {
            # Error Code 1 para "campo obligatorio faltante"
            # Error Code 2 para "error en tipo o formato de campo"
            "error_code": 1 if error.validator == "required" else 2,
            "message": error.message,
            "validator": error.validator,
            "validator_value": error.validator_value,
            "path": list(error.path),
            # La instancia validada es irrelevante si el error es de tipo 1
            "instance": (None if error.validator == "required" else
                         error.instance)
        }

        # Identifico a qué nivel de jerarquía sucedió el error.
        if len(error.path) >= 2 and error.path[0] == "dataset":
            # El error está a nivel de un dataset particular o inferior
            position = new_response["error"]["dataset"][error.path[1]]
        else:
            # El error está a nivel de catálogo
            position = new_response["error"]["catalog"]

        position["status"] = "ERROR"
        position["errors"].append(error_info)

        return new_response
844389
public function onResetPassword()
    {
        $rules = [
            'code'     => 'required',
            'password' => 'required|between:4,255'
        ];

        $validation = Validator::make(post(), $rules);
        if ($validation->fails()) {
            throw new ValidationException($validation);
        }

        $errorFields = ['code' => Lang::get(/*Invalid activation code supplied.*/'rainlab.user::lang.account.invalid_activation_code')];

        /*
         * Break up the code parts
         */
        $parts = explode('!', post('code'));
        if (count($parts) != 2) {
            throw new ValidationException($errorFields);
        }

        list($userId, $code) = $parts;

        if (!strlen(trim($userId)) || !strlen(trim($code)) || !$code) {
            throw new ValidationException($errorFields);
        }

        if (!$user = Auth::findUserById($userId)) {
            throw new ValidationException($errorFields);
        }

        if (!$user->attemptResetPassword($code, post('password'))) {
            throw new ValidationException($errorFields);
        }
    }
1263436
protected function validateEditField()
    {
        $this->setSubmitted('field');
        $this->setSubmitted('update', $this->data_field);

        $this->validateComponent('field');

        return !$this->hasErrors();
    }