Skip to content

response code 250 #527

@srakl

Description

@srakl

What steps will reproduce the problem?

when a user registers a new account, or uses social login, they get an error

[error][usuario] Expected response code 250 but got code "454", with message "454 Throttling failure: Daily message quota exceeded.

$_SESSION = [
    '__flash' => [
        'warning' => 1
    ]
    '_csrf-otofacts' => '8Ll4AlKy-x0wOOZObSqEKxckCw4BCTj1'
    'warning' => 'Error sending registration message to \"XXXXXXXX@gmail.com\". Please try again later.'
]

this is my registration action

public function actionRegister()
    {
        if (!$this->module->enableRegistration) {
            throw new NotFoundHttpException();
        }
        /** @var RegistrationForm $form */
        $form = $this->make(RegistrationForm::class);
        /** @var FormEvent $event */
        $event = $this->make(FormEvent::class, [$form]);

        $this->make(AjaxRequestModelValidator::class, [$form])->validate();

        if ($form->load(Yii::$app->request->post()) && $form->validate()) {
            $this->trigger(FormEvent::EVENT_BEFORE_REGISTER, $event);

            /** @var User $user */

            // Create a temporay $user so we can get the attributes, then get
            // the intersection between the $form fields  and the $user fields.
            $user = $this->make(User::class, [] );
            $fields = array_intersect_key($form->attributes, $user->attributes);

             // Becomes password_hash
            $fields['password'] = $form['password'];

            $user = $this->make(User::class, [], $fields );

            $user->setScenario('register');
            $mailService = MailFactory::makeWelcomeMailerService($user);

            if ($this->make(UserRegisterService::class, [$user, $mailService])->run()) {
                if ($this->module->enableEmailConfirmation) {
                    Yii::$app->session->setFlash(
                        'success',
                        Yii::t(
                            'usuario',
                            'Your account has been created and a message with further instructions has been sent to your email. Please follow the instructions to activate your account before logging in.'
                        )
                    );
                } else {
                    Yii::$app->session->setFlash('success', Yii::t('usuario', 'Your account has been created'));
                }
                $this->trigger(FormEvent::EVENT_AFTER_REGISTER, $event);

                $args = [
                    'link' => '<strong>'.Html::a(
                        'Click Here',
                        ['/'],
                        ['class' => 'alert-link']
                    ).'</strong>'
                ];

                return $this->render(
                    '/shared/message',
                    [
                        'title' => Yii::t('usuario', 'Your account has been created. {link} to continue.', $args),
                        'module' => $this->module,
                    ]
                );
                
            }
            Yii::$app->session->setFlash('danger', Yii::t('usuario', 'User could not be registered.'));
        }
        return $this->render('register', ['model' => $form, 'module' => $this->module]);
    }

any idea why? thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions