diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0cc1bb37..7dcd37ca 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,14 +13,12 @@ jobs: with: python-version: "3.11" - - name: Install lint dependencies - run: | - python -m pip install --upgrade pip - pip install ruff - - name: Lint with ruff - run: | - ruff --format=github --target-version=py311 account + uses: chartboost/ruff-action@v1 + with: + src: "./account" + version: 0.1.11 + args: --target-version=py311 test: name: Testing @@ -32,12 +30,18 @@ jobs: - "3.9" - "3.10" - "3.11" + - "3.12" django: - "3.2.*" - "4.2.*" + - "5.0.*" exclude: - python: "3.11" django: "3.2.*" + - python: "3.8" + django: "5.0.*" + - python: "3.9" + django: "5.0.*" steps: - uses: actions/checkout@v2 diff --git a/account/signals.py b/account/signals.py index 88df377c..47e5ce56 100644 --- a/account/signals.py +++ b/account/signals.py @@ -1,5 +1,6 @@ import django.dispatch + user_signed_up = django.dispatch.Signal() user_sign_up_attempt = django.dispatch.Signal() user_logged_in = django.dispatch.Signal() @@ -10,3 +11,4 @@ email_confirmation_sent = django.dispatch.Signal() password_changed = django.dispatch.Signal() password_expired = django.dispatch.Signal() +account_updated = django.dispatch.Signal() diff --git a/account/views.py b/account/views.py index 5fbf6473..fcaf8678 100644 --- a/account/views.py +++ b/account/views.py @@ -304,7 +304,7 @@ def send_email_confirmation(self, email_address): email_address.send_confirmation(site=get_current_site(self.request)) def after_signup(self, form): - signals.user_signed_up.send(sender=SignupForm, user=self.created_user, form=form) + signals.user_signed_up.send(sender=SignupForm, user=self.created_user, form=form, request=self.request) def login_user(self): user = auth.authenticate(**self.user_credentials()) @@ -796,6 +796,10 @@ def form_valid(self, form): def update_settings(self, form): self.update_email(form) self.update_account(form) + self.after_update_account() + + def after_update_account(self): + signals.account_updated.send(sender=SettingsView, user=self.request.user, request=self.request) def update_email(self, form, confirm=None): user = self.request.user diff --git a/docs/signals.rst b/docs/signals.rst index 356d6b7b..64cdbbde 100644 --- a/docs/signals.rst +++ b/docs/signals.rst @@ -8,7 +8,7 @@ user_signed_up -------------- Triggered when a user signs up successfully. Providing arguments ``user`` -(User instance) and ``form`` (form instance) as arguments. +(User instance), ``form`` (form instance), and ``request`` as arguments. user_sign_up_attempt @@ -73,4 +73,11 @@ password_expired ---------------- Triggered when a user password is expired. Providing argument ``user`` -(User instance). \ No newline at end of file +(User instance). + + +account_updated +--------------- + +Triggered when a user updates their account. Provided ``user`` and ``request`` +as arguments.