Skip to content

Commit

Permalink
🚧
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbal committed May 23, 2024
1 parent 651a47f commit 87de255
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/openforms/appointments/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def custom_submission_modifications(self, submission: Submission) -> Submission:
# data.
new_submission = Submission.objects.copy(submission)
if (form_auth := self.request.session.get(FORM_AUTH_SESSION_KEY)) is not None:
import pdb

pdb.set_trace()
store_auth_details(new_submission, form_auth)
return new_submission

Expand Down
2 changes: 2 additions & 0 deletions src/openforms/authentication/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .utils import (
is_authenticated_with_an_allowed_plugin,
is_authenticated_with_plugin,
remove_auth_info_from_session,
store_auth_details,
)

Expand All @@ -13,4 +14,5 @@
"store_auth_details",
"is_authenticated_with_plugin",
"is_authenticated_with_an_allowed_plugin",
"remove_auth_info_from_session",
]
14 changes: 12 additions & 2 deletions src/openforms/authentication/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@

from .constants import FORM_AUTH_SESSION_KEY, REGISTRATOR_SUBJECT_SESSION_KEY
from .registry import register
from .utils import store_auth_details, store_registrator_details
from .utils import (
remove_auth_info_from_session,
store_auth_details,
store_registrator_details,
)

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -55,6 +59,10 @@
def set_auth_attribute_on_session(
sender, instance: Submission, request: Request, anonymous=False, **kwargs
):
import pdb

pdb.set_trace()

if anonymous:
return

Expand Down Expand Up @@ -129,7 +137,7 @@ def set_auth_attribute_on_session(
# After the authentication details have been attached to the submission, the session
# no longer has to keep track of this information, because the user could start another
# form with different / no authentication
del request.session[FORM_AUTH_SESSION_KEY]
remove_auth_info_from_session(request)


@receiver(
Expand All @@ -153,3 +161,5 @@ def set_cosign_data_on_submission(
instance.co_sign_data = form_auth
instance.co_sign_data["cosign_date"] = timezone.now().isoformat()
instance.save()

remove_auth_info_from_session(request)
5 changes: 5 additions & 0 deletions src/openforms/authentication/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,8 @@ def get_cosign_login_url(request: Request, form: Form, plugin_id: str) -> str:
auth_page = furl(auth_url)
auth_page.args.set("next", next_url)
return auth_page.url


def remove_auth_info_from_session(request: Request) -> None:
if FORM_AUTH_SESSION_KEY in request.session:
del request.session[FORM_AUTH_SESSION_KEY]
3 changes: 2 additions & 1 deletion src/openforms/submissions/tasks/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def send_email_cosigner(submission_id: int) -> None:
"form_url": submission.cleaned_form_url,
},
)

logger.info("FOOO")
logger.info(submission.cleaned_form_url)
try:
send_mail_html(
subject=_("Co-sign request for {form_name}").format(
Expand Down

0 comments on commit 87de255

Please sign in to comment.