Skip to content

Commit

Permalink
feat: add code query param to /pro/attach
Browse files Browse the repository at this point in the history
  • Loading branch information
abhigyanghosh30 committed Jan 5, 2024
1 parent 7fd0b9c commit 02436e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions templates/pro/attach/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h2>Attach your machine</h2>
<div class="col-8">
<div class="p-form__control u-clearfix">
<input class="p-form-validation__input" type="text" aria-invalid="false"
id="magic-attach-code" name="userCode" maxlength="6"
id="magic-attach-code" name="userCode" maxlength="6" value="{{ magic_attach_code }}"
label="Enter the code displayed in your installation">
</div>
</div>
Expand Down Expand Up @@ -79,4 +79,4 @@ <h2>Attach your machine</h2>
text-transform: uppercase;
}
</style>
{% endblock content %}
{% endblock content %}
4 changes: 3 additions & 1 deletion webapp/shop/advantage/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,10 +647,11 @@ def activate_magic_attach(advantage_mapper, **kwargs):


@shop_decorator(area="advantage", permission="user", response="html")
@use_kwargs({"email": String(), "subscription": String()}, location="query")
@use_kwargs({"email": String(), "subscription": String(), "magic-attach-code": String()}, location="query")
def magic_attach_view(advantage_mapper: AdvantageMapper, **kwargs):
email = kwargs.get("email")
selected_id = kwargs.get("subscription")
magic_attach_code = kwargs.get("magic-attach-code")

user_subscriptions = advantage_mapper.get_user_subscriptions(
email=email, marketplaces=["canonical-ua"]
Expand All @@ -660,6 +661,7 @@ def magic_attach_view(advantage_mapper: AdvantageMapper, **kwargs):
"pro/attach/index.html",
subscriptions=user_subscriptions,
selected_id=selected_id,
magic_attach_code = magic_attach_code,
)


Expand Down

0 comments on commit 02436e3

Please sign in to comment.