Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3129 - Domain Renewal Form (Expiring Soon and Expired) - [AD] #3273

Merged
merged 53 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
d84a789
Renewal form
therealslimhsiehdy Dec 27, 2024
b5658a3
Fix linter
therealslimhsiehdy Dec 27, 2024
8b9eb93
added back domain renewal form
asaki222 Dec 30, 2024
19e5700
Add in the domain renewal template oops
therealslimhsiehdy Dec 30, 2024
e23d81f
added renew method
asaki222 Dec 30, 2024
8d8616e
added renewal form
asaki222 Dec 30, 2024
a128086
Update print statements and exp timing
therealslimhsiehdy Dec 31, 2024
c4b6037
Fix conflict and merge
therealslimhsiehdy Dec 31, 2024
c145ecb
put back the fixtures command
asaki222 Dec 31, 2024
e5f9696
added tests
asaki222 Jan 3, 2025
4feb29b
Add in tests for making edit is clickable and goes to right route
therealslimhsiehdy Jan 3, 2025
3f3ba22
Update text to click on link
therealslimhsiehdy Jan 3, 2025
dca70f4
Unit test for submit and recieving error message
therealslimhsiehdy Jan 4, 2025
bad8a8c
Fix padding on form and addin subtext for security email
therealslimhsiehdy Jan 4, 2025
a3c5004
Removing print statements
therealslimhsiehdy Jan 4, 2025
3dc445d
Update test and add in documentation
therealslimhsiehdy Jan 6, 2025
5f9a398
some test
asaki222 Jan 7, 2025
8c44092
created a new test for the submit and ack checkbox
asaki222 Jan 7, 2025
f14122d
Merge branch 'main' of https://github.com/cisagov/manage.get.gov into…
asaki222 Jan 7, 2025
a8808e5
ran app black
asaki222 Jan 7, 2025
26fcf6c
Merge branch 'main' of https://github.com/cisagov/manage.get.gov into…
therealslimhsiehdy Jan 7, 2025
b077f81
Address feedback - use form pattern and update error messaging
therealslimhsiehdy Jan 8, 2025
e196e02
Address linter errors
therealslimhsiehdy Jan 8, 2025
aad1ee9
Fix checkbox unchecked test
therealslimhsiehdy Jan 8, 2025
33e3659
Remove unused import for linter
therealslimhsiehdy Jan 8, 2025
628c4c0
expired domain renewal form
asaki222 Jan 8, 2025
99481c9
Merge branch 'main' of https://github.com/cisagov/manage.get.gov into…
asaki222 Jan 8, 2025
e8fede7
updated code to fix parsing error
asaki222 Jan 8, 2025
c7af664
ran app black .
asaki222 Jan 8, 2025
604a956
Merge branch 'rh/3129-domain-renewal-form' of https://github.com/cisa…
asaki222 Jan 8, 2025
acd20e8
Fix uncheck error
therealslimhsiehdy Jan 9, 2025
fbbdba0
Fix status alert, now show expiring soon checkbox filter etc
therealslimhsiehdy Jan 9, 2025
0148b6c
Fix test
therealslimhsiehdy Jan 9, 2025
c9c92e5
Allowing security email to display
therealslimhsiehdy Jan 9, 2025
27dae48
Fix spacing under None provided/Sec email
therealslimhsiehdy Jan 9, 2025
63b3198
Merge branch 'main' of https://github.com/cisagov/manage.get.gov into…
therealslimhsiehdy Jan 9, 2025
0e1d364
If not a domain manager and in non org model mode we should display c…
therealslimhsiehdy Jan 9, 2025
d35e09b
Fix linter
therealslimhsiehdy Jan 9, 2025
ca0ab8f
updated for pr feedback
asaki222 Jan 10, 2025
185c022
fixed conflicts
asaki222 Jan 10, 2025
6b2123d
reformatted and updated test
asaki222 Jan 10, 2025
6e1b352
Fix your contact info title
therealslimhsiehdy Jan 10, 2025
25ba5b2
Fix test capitalization
therealslimhsiehdy Jan 10, 2025
19114c7
Fix checkbox issue
therealslimhsiehdy Jan 10, 2025
53f48ba
Add in error above ack checkbox and allow edit even after refresh
therealslimhsiehdy Jan 10, 2025
737851d
fixed sidebar issue
asaki222 Jan 10, 2025
b47ab07
updated with comment
asaki222 Jan 10, 2025
dac673a
Fix wideness of the lines
therealslimhsiehdy Jan 10, 2025
9241790
added exec info true
asaki222 Jan 10, 2025
6b1185e
Merge branch 'rh/3129-domain-renewal-form' of https://github.com/cisa…
asaki222 Jan 10, 2025
797561d
Remove duplicated function
therealslimhsiehdy Jan 13, 2025
c3161ea
Merge branch 'main' of https://github.com/cisagov/manage.get.gov into…
therealslimhsiehdy Jan 13, 2025
ef43851
Merge branch 'main' of https://github.com/cisagov/manage.get.gov into…
therealslimhsiehdy Jan 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/developer/registry-access.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,31 @@ response = registry._client.transport.receive()
```

This is helpful for debugging situations where epplib is not correctly or fully parsing the XML returned from the registry.

### Adding in a expiring soon domain
The below scenario is if you are NOT in org model mode (`organization_feature` waffle flag is off).

1. Go to the `staging` sandbox and to `/admin`
2. Go to Domains and find a domain that is actually expired by sorting the Expiration Date column
3. Click into the domain to check the expiration date
4. Click into Manage Domain to double check the expiration date as well
5. Now hold onto that domain name, and save it for the command below

6. In a terminal, run these commands:
```
cf ssh getgov-<your-intials>
/tmp/lifecycle/shell
./manage.py shell
from registrar.models import Domain, DomainInvitation
from registrar.models import User
user = User.objects.filter(first_name="<your-first-name>")
domain = Domain.objects.get_or_create(name="<that-domain-here>")
```

7. Go back to `/admin` and create Domain Information for that domain you just added in via the terminal
8. Go to Domain to find it
9. Click Manage Domain
10. Add yourself as domain manager
11. Go to the Registrar page and you should now see the expiring domain

If you want to be in the org model mode, turn the `organization_feature` waffle flag on, and add that domain via Django Admin to a portfolio to be able to view it.
5 changes: 5 additions & 0 deletions src/registrar/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,11 @@
views.DomainSecurityEmailView.as_view(),
name="domain-security-email",
),
path(
"domain/<int:pk>/renewal",
views.DomainRenewalView.as_view(),
name="domain-renewal",
),
path(
"domain/<int:pk>/users/add",
views.DomainAddUserView.as_view(),
Expand Down
1 change: 1 addition & 0 deletions src/registrar/forms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
DomainDsdataFormset,
DomainDsdataForm,
DomainSuborganizationForm,
DomainRenewalForm,
)
from .portfolio import (
PortfolioOrgAddressForm,
Expand Down
12 changes: 12 additions & 0 deletions src/registrar/forms/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,3 +661,15 @@ def clean(self):
extra=0,
can_delete=True,
)


class DomainRenewalForm(forms.Form):
"""Form making sure domain renewal ack is checked"""

is_policy_acknowledged = forms.BooleanField(
required=True,
label="I have read and agree to the requirements for operating a .gov domain.",
error_messages={
"required": "Check the box if you read and agree to the requirements for operating a .gov domain."
},
)
12 changes: 7 additions & 5 deletions src/registrar/models/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,8 @@ def renew_domain(self, length: int = 1, unit: epp.Unit = epp.Unit.YEAR):
exp_date = self.registry_expiration_date
except KeyError:
# if no expiration date from registry, set it to today
logger.warning("current expiration date not set; setting to today")
logger.warning("current expiration date not set; setting to today", exc_info=True)
exp_date = date.today()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor changes requested: I see the renew code is logging errors below here but it is not printing the full traceback or the domain that threw the error. Please change both the RegistryError and normal exception to include traceback and domain name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind elaborating or give an example of what you mean by traceback (I'm looking into our code for a pattern, but want to make sure I'm referencing the right area 😅)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no problem you just want to add exec_info=true on the logger line! docs
example from our code:
logger.warning("Failed to send confirmation email", exc_info=True)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

# create RenewDomain request
request = commands.RenewDomain(name=self.name, cur_exp_date=exp_date, period=epp.Period(length, unit))

Expand All @@ -338,13 +337,14 @@ def renew_domain(self, length: int = 1, unit: epp.Unit = epp.Unit.YEAR):
self._cache["ex_date"] = registry.send(request, cleaned=True).res_data[0].ex_date
self.expiration_date = self._cache["ex_date"]
self.save()

except RegistryError as err:
# if registry error occurs, log the error, and raise it as well
logger.error(f"registry error renewing domain: {err}")
logger.error(f"Registry error renewing domain '{self.name}': {err}")
raise (err)
except Exception as e:
# exception raised during the save to registrar
logger.error(f"error updating expiration date in registrar: {e}")
logger.error(f"Error updating expiration date for domain '{self.name}' in registrar: {e}")
raise (e)

@Cache
Expand Down Expand Up @@ -1575,7 +1575,7 @@ def dns_needed(self):
logger.info("Changing to DNS_NEEDED state")
logger.info("able to transition to DNS_NEEDED state")

def get_state_help_text(self) -> str:
def get_state_help_text(self, request=None) -> str:
"""Returns a str containing additional information about a given state.
Returns custom content for when the domain itself is expired."""

Expand All @@ -1585,6 +1585,8 @@ def get_state_help_text(self) -> str:
help_text = (
"This domain has expired, but it is still online. " "To renew this domain, contact [email protected]."
)
elif flag_is_active(request, "domain_renewal") and self.is_expiring():
help_text = "This domain will expire soon. Contact one of the listed domain managers to renew the domain."
else:
help_text = Domain.State.get_help_text(self.state)

Expand Down
9 changes: 7 additions & 2 deletions src/registrar/templates/domain_base.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% extends "base.html" %}
{% load static %}
{% load static url_helpers %}


{% block title %}{{ domain.name }} | {% endblock %}

Expand Down Expand Up @@ -53,13 +55,16 @@ <h4 class="usa-alert__heading larger-font-sizing">Attention!</h4>
{% endif %}

{% block domain_content %}

{% if request.path|endswith:"renewal"%}
<h1>Renew {{domain.name}} </h1>
{%else%}
<h1 class="break-word">Domain Overview</h1>
{% endif%}

{% endblock %} {# domain_content #}
{% endif %}
</main>
</div>
</div>
</div>
{% endblock %} {# content #}
{% endblock %} {# content #}
12 changes: 10 additions & 2 deletions src/registrar/templates/domain_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,18 @@ <h2 class="text-bold text-primary-dark domain-name-wrap">{{ domain.name }}</h2>
</span>
{% if domain.get_state_help_text %}
<div class="padding-top-1 text-primary-darker">
{% if has_domain_renewal_flag and domain.is_expiring and is_domain_manager %}
This domain will expire soon. <a href="/not-available-yet">Renew to maintain access.</a>
{% if has_domain_renewal_flag and domain.is_expired and is_domain_manager %}
This domain has expired, but it is still online.
{% url 'domain-renewal' pk=domain.id as url %}
<a href="{{ url }}">Renew to maintain access.</a>
{% elif has_domain_renewal_flag and domain.is_expiring and is_domain_manager %}
This domain will expire soon.
{% url 'domain-renewal' pk=domain.id as url %}
<a href="{{ url }}">Renew to maintain access.</a>
{% elif has_domain_renewal_flag and domain.is_expiring and is_portfolio_user %}
This domain will expire soon. Contact one of the listed domain managers to renew the domain.
{% elif has_domain_renewal_flag and domain.is_expired and is_portfolio_user %}
This domain has expired, but it is still online. Contact one of the listed domain managers to renew the domain.
{% else %}
{{ domain.get_state_help_text }}
{% endif %}
Expand Down
140 changes: 140 additions & 0 deletions src/registrar/templates/domain_renewal.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
{% extends "domain_base.html" %}
{% load static url_helpers %}
{% load custom_filters %}

{% block domain_content %}
{% block breadcrumb %}

<!-- Banner for if_policy_acknowledged -->
{% if form.is_policy_acknowledged.errors %}
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2">
<div class="usa-alert__body">
{% for error in form.is_policy_acknowledged.errors %}
<p class="usa-alert__text">{{ error }}</p>
{% endfor %}
</div>
</div>
{% endif %}

{% if portfolio %}
<!-- Navigation breadcrumbs -->
<nav class="usa-breadcrumb padding-top-0" aria-label="Domain breadcrumb">
<ol class="usa-breadcrumb__list">
<li class="usa-breadcrumb__list-item">
<a href="{% url 'domains' %}" class="usa-breadcrumb__link"><span>Domains</span></a>
</li>
<li class="usa-breadcrumb__list-item">
<a href="{% url 'domain' pk=domain.id %}" class="usa-breadcrumb__link"><span>{{domain.name}}</span></a>
</li>
<li class="usa-breadcrumb__list-item usa-current" aria-current="page">
<span>Renewal Form</span>
</li>

</ol>
</nav>
{% endif %}
{% endblock breadcrumb %}

{{ block.super }}
<div class="margin-top-4 tablet:grid-col-10">
<h2 class="text-bold text-primary-dark domain-name-wrap">Confirm the following information for accuracy</h2>
<p>Review these details below. We <a href="https://get.gov/domains/requirements/#what-.gov-domain-registrants-must-do" class="usa-link">
require</a> that you maintain accurate information for the domain.
The details you provide will only be used to support the administration of .gov and won't be made public.
</p>
<p>If you would like to retire your domain instead, please <a href="https://get.gov/contact/" class="usa-link">
contact us</a>. </p>
<p><em>Required fields are marked with an asterisk (<abbr class="usa-hint usa-hint--required" title="required">*</abbr>).</em>
</p>


{% url 'user-profile' as url %}
{% include "includes/summary_item.html" with title='Your contact information' value=request.user edit_link=url editable=is_editable contact='true' %}

{% if analyst_action != 'edit' or analyst_action_location != domain.pk %}
{% if is_portfolio_user and not is_domain_manager %}
<div class="usa-alert usa-alert--info usa-alert--slim">
<div class="usa-alert__body">
<p class="usa-alert__text ">
You don't have access to manage {{domain.name}}. If you need to make updates, contact one of the listed domain managers.
</p>
</div>
</div>
{% endif %}
{% endif %}

{% url 'domain-security-email' pk=domain.id as url %}
{% if security_email is not None and security_email not in hidden_security_emails%}
{% include "includes/summary_item.html" with title='Security email' value=security_email custom_text_for_value_none='We strongly recommend that you provide a security email. This email will allow the public to report observed or suspected security issues on your domain.' edit_link=url editable=is_editable %}
{% else %}
{% include "includes/summary_item.html" with title='Security email' value='None provided' custom_text_for_value_none='We strongly recommend that you provide a security email. This email will allow the public to report observed or suspected security issues on your domain.' edit_link=url editable=is_editable %}
{% endif %}

{% url 'domain-users' pk=domain.id as url %}
{% if portfolio %}
{% include "includes/summary_item.html" with title='Domain managers' domain_permissions=True value=domain edit_link=url editable=is_editable %}
{% else %}
{% include "includes/summary_item.html" with title='Domain managers' list=True users=True value=domain.permissions.all edit_link=url editable=is_editable %}
{% endif %}

<div class="border-top-1px border-primary-dark padding-top-1 margin-top-3 margin-bottom-2">

<fieldset class="usa-fieldset">
<legend>
<h3 class="summary-item__title
font-sans-md
text-primary-dark
text-semibold
margin-top-0
margin-bottom-05
padding-right-1">
Acknowledgement of .gov domain requirements </h3>
</legend>

<form method="post" action="{% url 'domain-renewal' pk=domain.id %}">
{% csrf_token %}
<div class="usa-checkbox">

{% if form.is_policy_acknowledged.errors %}
{% for error in form.is_policy_acknowledged.errors %}
<div class="usa-error-message display-flex" role="alert">
<svg class="usa-icon usa-icon--large" focusable="true" role="img" aria-label="Error">
<use xlink:href="{%static 'img/sprite.svg'%}#error"></use>
</svg>
<span class="margin-left-05">{{ error }}</span>
</div>
{% endfor %}
</div>
{% endif %}

<input type="hidden" name="is_policy_acknowledged" value="False">

<input
class="usa-checkbox__input"
id="renewal-checkbox"
type="checkbox"
name="is_policy_acknowledged"
value="True"
{% if form.is_policy_acknowledged.value %}checked{% endif %}
>
<label class="usa-checkbox__label" for="renewal-checkbox">
I read and agree to the
<a href="https://get.gov/domains/requirements/" class="usa-link">
requirements for operating a .gov domain
</a>.
<abbr class="usa-hint usa-hint--required" title="required">*</abbr>
</label>
</div>

<button
type="submit"
name="submit_button"
value="next"
class="usa-button margin-top-3"
> Submit
</button>
</form>
</fieldset>
</div> <!-- End of the acknowledgement section div -->
</div>
{% endblock %} {# domain_content #}
11 changes: 10 additions & 1 deletion src/registrar/templates/domain_sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,16 @@
{% include "includes/domain_sidenav_item.html" with item_text="Domain managers" %}
{% endwith %}


{% if has_domain_renewal_flag and is_domain_manager%}
{% if domain.is_expiring or domain.is_expired %}
{% with url_name="domain-renewal" %}
{% include "includes/domain_sidenav_item.html" with item_text="Renewal form" %}
{% endwith %}
{% endif %}
{% endif %}

{% endif %}
</ul>
</nav>
</div>
</div>
2 changes: 1 addition & 1 deletion src/registrar/templates/includes/domains_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ <h2>Status</h2>
>Deleted</label
>
</div>
{% if has_domain_renewal_flag and num_expiring_domains > 0 %}
{% if has_domain_renewal_flag %}
<div class="usa-checkbox">
<input
class="usa-checkbox__input"
Expand Down
10 changes: 5 additions & 5 deletions src/registrar/templates/includes/summary_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ <h4 class="h4--sm-05">Invited domain managers</h4>
</ul>
{% endif %}
{% else %}
<p class="margin-top-0 margin-bottom-0">
{% if custom_text_for_value_none %}
<p class="margin-top-0 text-base-dark">{{ custom_text_for_value_none }}</p>
{% endif %}
{% if value %}
{{ value }}
{% elif custom_text_for_value_none %}
{{ custom_text_for_value_none }}
{% else %}
{% endif %}
{% if not value %}
None
{% endif %}
</p>
{% endif %}
</div>

Expand Down
1 change: 1 addition & 0 deletions src/registrar/templatetags/custom_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def is_domain_subpage(path):
"domain-users-add",
"domain-request-delete",
"domain-user-delete",
"domain-renewal",
"invitation-cancel",
]
return get_url_name(path) in url_names
Expand Down
Loading
Loading