2amigos / yii2-usuario

Highly customizable and extensible user management, authentication, and authorization Yii2 extension
https://github.com/2amigos/yii2-usuario
Other
294 stars 142 forks source link

response code 250 #527

Open srakl opened 11 months ago

srakl commented 11 months ago

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.

srakl commented 11 months ago

I think i figured it out, its the AWS SES quota, requested for an upgrade. Hopefully it will work after they approve it.

srakl commented 11 months ago

how do i turn off social login welcome email?

i get this this in logs

[usuario] Error sending welcome message to ...