mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-27 04:58:42 +02:00
Merge branch 'main' into za/3317-hide-org-federal-agencies
This commit is contained in:
commit
8419d22f67
14 changed files with 159 additions and 85 deletions
|
@ -129,7 +129,7 @@ export class BaseTable {
|
||||||
this.displayName = itemName;
|
this.displayName = itemName;
|
||||||
this.sectionSelector = itemName + 's';
|
this.sectionSelector = itemName + 's';
|
||||||
this.tableWrapper = document.getElementById(`${this.sectionSelector}__table-wrapper`);
|
this.tableWrapper = document.getElementById(`${this.sectionSelector}__table-wrapper`);
|
||||||
this.tableHeaders = document.querySelectorAll(`#${this.sectionSelector} th[data-sortable]`);
|
this.tableHeaderSortButtons = document.querySelectorAll(`#${this.sectionSelector} th[data-sortable] button`);
|
||||||
this.currentSortBy = 'id';
|
this.currentSortBy = 'id';
|
||||||
this.currentOrder = 'asc';
|
this.currentOrder = 'asc';
|
||||||
this.currentStatus = [];
|
this.currentStatus = [];
|
||||||
|
@ -303,13 +303,18 @@ export class BaseTable {
|
||||||
* A helper that resets sortable table headers
|
* A helper that resets sortable table headers
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
unsetHeader = (header) => {
|
unsetHeader = (headerSortButton) => {
|
||||||
|
let header = headerSortButton.closest('th');
|
||||||
|
if (header) {
|
||||||
header.removeAttribute('aria-sort');
|
header.removeAttribute('aria-sort');
|
||||||
let headerName = header.innerText;
|
let headerName = header.innerText;
|
||||||
const headerLabel = `${headerName}, sortable column, currently unsorted"`;
|
const headerLabel = `${headerName}, sortable column, currently unsorted"`;
|
||||||
const headerButtonLabel = `Click to sort by ascending order.`;
|
const headerButtonLabel = `Click to sort by ascending order.`;
|
||||||
header.setAttribute("aria-label", headerLabel);
|
header.setAttribute("aria-label", headerLabel);
|
||||||
header.querySelector('.usa-table__header__button').setAttribute("title", headerButtonLabel);
|
header.querySelector('.usa-table__header__button').setAttribute("title", headerButtonLabel);
|
||||||
|
} else {
|
||||||
|
console.warn('Issue with DOM');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -505,9 +510,10 @@ export class BaseTable {
|
||||||
|
|
||||||
// Add event listeners to table headers for sorting
|
// Add event listeners to table headers for sorting
|
||||||
initializeTableHeaders() {
|
initializeTableHeaders() {
|
||||||
this.tableHeaders.forEach(header => {
|
this.tableHeaderSortButtons.forEach(tableHeader => {
|
||||||
header.addEventListener('click', event => {
|
tableHeader.addEventListener('click', event => {
|
||||||
let button = header.querySelector('.usa-table__header__button')
|
let header = tableHeader.closest('th');
|
||||||
|
if (header) {
|
||||||
const sortBy = header.getAttribute('data-sortable');
|
const sortBy = header.getAttribute('data-sortable');
|
||||||
let order = 'asc';
|
let order = 'asc';
|
||||||
// sort order will be ascending, unless the currently sorted column is ascending, and the user
|
// sort order will be ascending, unless the currently sorted column is ascending, and the user
|
||||||
|
@ -517,12 +523,8 @@ export class BaseTable {
|
||||||
}
|
}
|
||||||
// load the results with the updated sort
|
// load the results with the updated sort
|
||||||
this.loadTable(1, sortBy, order);
|
this.loadTable(1, sortBy, order);
|
||||||
// If the click occurs outside of the button, need to simulate a button click in order
|
} else {
|
||||||
// for USWDS listener on the button to execute.
|
console.warn('Issue with DOM');
|
||||||
// Check first to see if click occurs outside of the button
|
|
||||||
if (!button.contains(event.target)) {
|
|
||||||
// Simulate a button click
|
|
||||||
button.click();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -587,9 +589,9 @@ export class BaseTable {
|
||||||
|
|
||||||
// Reset UI and accessibility
|
// Reset UI and accessibility
|
||||||
resetHeaders() {
|
resetHeaders() {
|
||||||
this.tableHeaders.forEach(header => {
|
this.tableHeaderSortButtons.forEach(headerSortButton => {
|
||||||
// Unset sort UI in headers
|
// Unset sort UI in headers
|
||||||
this.unsetHeader(header);
|
this.unsetHeader(headerSortButton);
|
||||||
});
|
});
|
||||||
// Reset the announcement region
|
// Reset the announcement region
|
||||||
this.tableAnnouncementRegion.innerHTML = '';
|
this.tableAnnouncementRegion.innerHTML = '';
|
||||||
|
|
|
@ -35,16 +35,19 @@ export class MemberDomainsTable extends BaseTable {
|
||||||
showElement(dataWrapper);
|
showElement(dataWrapper);
|
||||||
hideElement(noSearchResultsWrapper);
|
hideElement(noSearchResultsWrapper);
|
||||||
hideElement(noDataWrapper);
|
hideElement(noDataWrapper);
|
||||||
|
this.tableAnnouncementRegion.innerHTML = '';
|
||||||
} else {
|
} else {
|
||||||
hideElement(dataWrapper);
|
hideElement(dataWrapper);
|
||||||
showElement(noSearchResultsWrapper);
|
showElement(noSearchResultsWrapper);
|
||||||
hideElement(noDataWrapper);
|
hideElement(noDataWrapper);
|
||||||
|
this.tableAnnouncementRegion.innerHTML = this.noSearchResultsWrapper.innerHTML;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
hideElement(searchSection);
|
hideElement(searchSection);
|
||||||
hideElement(dataWrapper);
|
hideElement(dataWrapper);
|
||||||
hideElement(noSearchResultsWrapper);
|
hideElement(noSearchResultsWrapper);
|
||||||
showElement(noDataWrapper);
|
showElement(noDataWrapper);
|
||||||
|
this.tableAnnouncementRegion.innerHTML = this.noDataWrapper.innerHTML;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1582,11 +1582,9 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
if self.is_expired() and self.state != self.State.UNKNOWN:
|
if self.is_expired() and self.state != self.State.UNKNOWN:
|
||||||
# Given expired is not a physical state, but it is displayed as such,
|
# Given expired is not a physical state, but it is displayed as such,
|
||||||
# We need custom logic to determine this message.
|
# We need custom logic to determine this message.
|
||||||
help_text = (
|
help_text = "This domain has expired. Complete the online renewal process to maintain access."
|
||||||
"This domain has expired, but it is still online. " "To renew this domain, contact help@get.gov."
|
|
||||||
)
|
|
||||||
elif flag_is_active(request, "domain_renewal") and self.is_expiring():
|
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."
|
help_text = "This domain is expiring soon. Complete the online renewal process to maintain access."
|
||||||
else:
|
else:
|
||||||
help_text = Domain.State.get_help_text(self.state)
|
help_text = Domain.State.get_help_text(self.state)
|
||||||
|
|
||||||
|
|
|
@ -171,11 +171,14 @@ class User(AbstractUser):
|
||||||
now = timezone.now().date()
|
now = timezone.now().date()
|
||||||
expiration_window = 60
|
expiration_window = 60
|
||||||
threshold_date = now + timedelta(days=expiration_window)
|
threshold_date = now + timedelta(days=expiration_window)
|
||||||
|
acceptable_statuses = [Domain.State.UNKNOWN, Domain.State.DNS_NEEDED, Domain.State.READY]
|
||||||
|
|
||||||
num_of_expiring_domains = Domain.objects.filter(
|
num_of_expiring_domains = Domain.objects.filter(
|
||||||
id__in=domain_ids,
|
id__in=domain_ids,
|
||||||
expiration_date__isnull=False,
|
expiration_date__isnull=False,
|
||||||
expiration_date__lte=threshold_date,
|
expiration_date__lte=threshold_date,
|
||||||
expiration_date__gt=now,
|
expiration_date__gt=now,
|
||||||
|
state__in=acceptable_statuses,
|
||||||
).count()
|
).count()
|
||||||
return num_of_expiring_domains
|
return num_of_expiring_domains
|
||||||
|
|
||||||
|
|
|
@ -49,11 +49,11 @@
|
||||||
{% if has_domain_renewal_flag and domain.is_expired and is_domain_manager %}
|
{% if has_domain_renewal_flag and domain.is_expired and is_domain_manager %}
|
||||||
This domain has expired, but it is still online.
|
This domain has expired, but it is still online.
|
||||||
{% url 'domain-renewal' pk=domain.id as url %}
|
{% url 'domain-renewal' pk=domain.id as url %}
|
||||||
<a href="{{ url }}">Renew to maintain access.</a>
|
<a href="{{ url }}" class="usa-link">Renew to maintain access.</a>
|
||||||
{% elif has_domain_renewal_flag and domain.is_expiring and is_domain_manager %}
|
{% elif has_domain_renewal_flag and domain.is_expiring and is_domain_manager %}
|
||||||
This domain will expire soon.
|
This domain will expire soon.
|
||||||
{% url 'domain-renewal' pk=domain.id as url %}
|
{% url 'domain-renewal' pk=domain.id as url %}
|
||||||
<a href="{{ url }}">Renew to maintain access.</a>
|
<a href="{{ url }}" class="usa-link">Renew to maintain access.</a>
|
||||||
{% elif has_domain_renewal_flag and domain.is_expiring and is_portfolio_user %}
|
{% 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.
|
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 %}
|
{% elif has_domain_renewal_flag and domain.is_expired and is_portfolio_user %}
|
||||||
|
|
|
@ -38,11 +38,11 @@
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
<div class="margin-top-4 tablet:grid-col-10">
|
<div class="margin-top-4 tablet:grid-col-10">
|
||||||
<h2 class="domain-name-wrap">Confirm the following information for accuracy</h2>
|
<h2 class="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">
|
<p>Review the details below. We <a href="https://get.gov/domains/requirements/#what-.gov-domain-registrants-must-do" class="usa-link" target="_blank">
|
||||||
require</a> that you maintain accurate information for the domain.
|
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.
|
The details you provide will only be used to support the administration of .gov and won't be made public.
|
||||||
</p>
|
</p>
|
||||||
<p>If you would like to retire your domain instead, please <a href="https://get.gov/contact/" class="usa-link">
|
<p>If you would like to retire your domain instead, please <a href="https://get.gov/contact/" class="usa-link" target="_blank">
|
||||||
contact us</a>. </p>
|
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><em>Required fields are marked with an asterisk (<abbr class="usa-hint usa-hint--required" title="required">*</abbr>).</em>
|
||||||
</p>
|
</p>
|
||||||
|
@ -98,7 +98,7 @@
|
||||||
{% if form.is_policy_acknowledged.errors %}
|
{% if form.is_policy_acknowledged.errors %}
|
||||||
{% for error in form.is_policy_acknowledged.errors %}
|
{% for error in form.is_policy_acknowledged.errors %}
|
||||||
<div class="usa-error-message display-flex" role="alert">
|
<div class="usa-error-message display-flex" role="alert">
|
||||||
<svg class="usa-icon usa-icon--large" focusable="true" role="img" aria-label="Error">
|
<svg class="usa-icon usa-icon--large" focusable="true" role="img" aria-label="Error: Check the box if you read and agree to the requirements for operating a .gov domain.">
|
||||||
<use xlink:href="{%static 'img/sprite.svg'%}#error"></use>
|
<use xlink:href="{%static 'img/sprite.svg'%}#error"></use>
|
||||||
</svg>
|
</svg>
|
||||||
<span class="margin-left-05">{{ error }}</span>
|
<span class="margin-left-05">{{ error }}</span>
|
||||||
|
@ -119,10 +119,8 @@
|
||||||
>
|
>
|
||||||
<label class="usa-checkbox__label" for="renewal-checkbox">
|
<label class="usa-checkbox__label" for="renewal-checkbox">
|
||||||
I read and agree to the
|
I read and agree to the
|
||||||
<a href="https://get.gov/domains/requirements/" class="usa-link">
|
<a href="https://get.gov/domains/requirements/" class="usa-link" target="_blank">
|
||||||
requirements for operating a .gov domain
|
requirements for operating a .gov domain</a>.<abbr class="usa-hint usa-hint--required" title="required">*</abbr>
|
||||||
</a>.
|
|
||||||
<abbr class="usa-hint usa-hint--required" title="required">*</abbr>
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -131,7 +129,7 @@
|
||||||
name="submit_button"
|
name="submit_button"
|
||||||
value="next"
|
value="next"
|
||||||
class="usa-button margin-top-3"
|
class="usa-button margin-top-3"
|
||||||
> Submit
|
> Submit and renew
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% if domain.expiration_date or domain.created_at %}
|
{% if domain.expiration_date or domain.created_at %}
|
||||||
<p>
|
<p>
|
||||||
{% if domain.expiration_date %}
|
{% if domain.expiration_date %}
|
||||||
<strong class="text-primary-dark">Expires:</strong>
|
<strong class="text-primary-dark">Date of expiration:</strong>
|
||||||
{{ domain.expiration_date|date }}
|
{{ domain.expiration_date|date }}
|
||||||
{% if domain.is_expired %} <span class="text-error"><strong>(expired)</strong></span>{% endif %}
|
{% if domain.is_expired %} <span class="text-error"><strong>(expired)</strong></span>{% endif %}
|
||||||
<br/>
|
<br/>
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
<!----------------------------------------------------------------------
|
<!----------------------------------------------------------------------
|
||||||
This link is commented out because we intend to add it back in later.
|
This link is commented out because we intend to add it back in later.
|
||||||
------------------------------------------------------------------------->
|
------------------------------------------------------------------------->
|
||||||
<!-- <a href="{% url 'export_data_type_requests' %}" class="usa-button usa-button--unstyled usa-button--with-icon usa-button--justify-right" role="button">
|
<!-- <a href="{% url 'export_data_type_requests' %}" class="usa-button usa-button--unstyled usa-button--with-icon usa-button--justify-right">
|
||||||
<svg class="usa-icon usa-icon--large" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
<svg class="usa-icon usa-icon--large" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
||||||
<use xlink:href="{% static 'img/sprite.svg' %}#file_download"></use>
|
<use xlink:href="{% static 'img/sprite.svg' %}#file_download"></use>
|
||||||
</svg>Export as CSV
|
</svg>Export as CSV
|
||||||
|
@ -78,6 +78,7 @@
|
||||||
id="domain-requests__usa-button--filter"
|
id="domain-requests__usa-button--filter"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
aria-controls="filter-status"
|
aria-controls="filter-status"
|
||||||
|
aria-label="Status, list 7 items"
|
||||||
>
|
>
|
||||||
<span class="text-bold display-none" id="domain-requests__filter-indicator"></span> Status
|
<span class="text-bold display-none" id="domain-requests__filter-indicator"></span> Status
|
||||||
<svg class="usa-icon top-2px" aria-hidden="true" focusable="false" role="img" width="24">
|
<svg class="usa-icon top-2px" aria-hidden="true" focusable="false" role="img" width="24">
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
|
|
||||||
<!-- Org model banner (org manager can view, domain manager can edit) -->
|
<!-- Org model banner (org manager can view, domain manager can edit) -->
|
||||||
{% if has_domain_renewal_flag and num_expiring_domains > 0 and has_any_domains_portfolio_permission %}
|
{% if has_domain_renewal_flag and num_expiring_domains > 0 and has_any_domains_portfolio_permission %}
|
||||||
<section class="usa-site-alert usa-site-alert--info margin-bottom-2 {% if add_class %}{{ add_class }}{% endif %}" aria-label="Site alert">
|
<section class="usa-site-alert--slim usa-site-alert--info margin-bottom-2 {% if add_class %}{{ add_class }}{% endif %}" aria-label="Site alert">
|
||||||
<div class="usa-alert">
|
<div class="usa-alert">
|
||||||
<div class="usa-alert__body usa-alert__body--widescreen">
|
<div class="usa-alert__body">
|
||||||
<p class="usa-alert__text maxw-none">
|
<p class="usa-alert__text maxw-none">
|
||||||
{% if num_expiring_domains == 1%}
|
{% if num_expiring_domains == 1%}
|
||||||
One domain will expire soon. Go to "Manage" to renew the domain. <a href="#" id="link-expiring-domains" class="usa-link">Show expiring domain.</a>
|
One domain will expire soon. Go to "Manage" to renew the domain. <a href="#" id="link-expiring-domains" class="usa-link" tabindex="0" aria-label="Show expiring domains. This will filter the Domains table to only show the expiring domain.">Show expiring domain.</a>
|
||||||
{% else%}
|
{% else%}
|
||||||
Multiple domains will expire soon. Go to "Manage" to renew the domains. <a href="#" id="link-expiring-domains" class="usa-link">Show expiring domains.</a>
|
Multiple domains will expire soon. Go to "Manage" to renew the domains. <a href="#" id="link-expiring-domains" class="usa-link" tabindex="0" aria-label="Show expiring domains. This will filter the Domains table to only show the expiring domains.">Show expiring domains.</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
{% if user_domain_count and user_domain_count > 0 %}
|
{% if user_domain_count and user_domain_count > 0 %}
|
||||||
<div class="section-outlined__utility-button mobile-lg:padding-right-105 {% if portfolio %} mobile:grid-col-12 desktop:grid-col-6 desktop:padding-left-3{% endif %}">
|
<div class="section-outlined__utility-button mobile-lg:padding-right-105 {% if portfolio %} mobile:grid-col-12 desktop:grid-col-6 desktop:padding-left-3{% endif %}">
|
||||||
<section aria-label="Domains report component" class="margin-top-205">
|
<section aria-label="Domains report component" class="margin-top-205">
|
||||||
<a href="{% url 'export_data_type_user' %}" class="usa-button usa-button--unstyled usa-button--with-icon usa-button--justify-right" role="button">
|
<a href="{% url 'export_data_type_user' %}" class="usa-button usa-button--unstyled usa-button--with-icon usa-button--justify-right">
|
||||||
<svg class="usa-icon usa-icon--large" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
<svg class="usa-icon usa-icon--large" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
||||||
<use xlink:href="{%static 'img/sprite.svg'%}#file_download"></use>
|
<use xlink:href="{%static 'img/sprite.svg'%}#file_download"></use>
|
||||||
</svg>Export as CSV
|
</svg>Export as CSV
|
||||||
|
@ -76,14 +76,14 @@
|
||||||
|
|
||||||
<!-- Non org model banner -->
|
<!-- Non org model banner -->
|
||||||
{% if has_domain_renewal_flag and num_expiring_domains > 0 and not portfolio %}
|
{% if has_domain_renewal_flag and num_expiring_domains > 0 and not portfolio %}
|
||||||
<section class="usa-site-alert usa-site-alert--info margin-bottom-2 {% if add_class %}{{ add_class }}{% endif %}" aria-label="Site alert">
|
<section class="usa-site-alert--slim usa-site-alert--info margin-bottom-2 {% if add_class %}{{ add_class }}{% endif %}" aria-label="Site alert">
|
||||||
<div class="usa-alert">
|
<div class="usa-alert">
|
||||||
<div class="usa-alert__body usa-alert__body--widescreen">
|
<div class="usa-alert__body">
|
||||||
<p class="usa-alert__text maxw-none">
|
<p class="usa-alert__text maxw-none">
|
||||||
{% if num_expiring_domains == 1%}
|
{% if num_expiring_domains == 1%}
|
||||||
One domain will expire soon. Go to "Manage" to renew the domain. <a href="#" id="link-expiring-domains" class="usa-link">Show expiring domain.</a>
|
One domain will expire soon. Go to "Manage" to renew the domain. <a href="#" id="link-expiring-domains" class="usa-link" tabindex="0" aria-label="Show expiring domains. This will filter the Domains table to only show the expiring domain.">Show expiring domain.</a>
|
||||||
{% else%}
|
{% else%}
|
||||||
Multiple domains will expire soon. Go to "Manage" to renew the domains. <a href="#" id="link-expiring-domains" class="usa-link">Show expiring domains.</a>
|
Multiple domains will expire soon. Go to "Manage" to renew the domains. <a href="#" id="link-expiring-domains" class="usa-link" tabindex="0" aria-label="Show expiring domains. This will filter the Domains table to only show the expiring domains.">Show expiring domains.</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -101,6 +101,7 @@
|
||||||
id="domains__usa-button--filter"
|
id="domains__usa-button--filter"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
aria-controls="filter-status"
|
aria-controls="filter-status"
|
||||||
|
aria-label="Status, list 5 items"
|
||||||
>
|
>
|
||||||
<span class="text-bold display-none" id="domains__filter-indicator"></span> Status
|
<span class="text-bold display-none" id="domains__filter-indicator"></span> Status
|
||||||
<svg class="usa-icon top-2px" aria-hidden="true" focusable="false" role="img" width="24">
|
<svg class="usa-icon top-2px" aria-hidden="true" focusable="false" role="img" width="24">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="section-outlined__utility-button mobile-lg:padding-right-105 {% if portfolio %} mobile:grid-col-12 desktop:grid-col-6 desktop:padding-left-3{% endif %}">
|
<div class="section-outlined__utility-button mobile-lg:padding-right-105 {% if portfolio %} mobile:grid-col-12 desktop:grid-col-6 desktop:padding-left-3{% endif %}">
|
||||||
<section aria-label="Domains report component" class="margin-top-205">
|
<section aria-label="Domains report component" class="margin-top-205">
|
||||||
<a href="{% url 'export_members_portfolio' %}" class="usa-button usa-button--unstyled usa-button--with-icon usa-button--justify-right" role="button">
|
<a href="{% url 'export_members_portfolio' %}" class="usa-button usa-button--unstyled usa-button--with-icon usa-button--justify-right">
|
||||||
<svg class="usa-icon usa-icon--large" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
<svg class="usa-icon usa-icon--large" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
||||||
<use xlink:href="{%static 'img/sprite.svg'%}#file_download"></use>
|
<use xlink:href="{%static 'img/sprite.svg'%}#file_download"></use>
|
||||||
</svg>Export as CSV
|
</svg>Export as CSV
|
||||||
|
|
|
@ -214,7 +214,7 @@ class HomeTests(TestWithUser):
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_state_help_text_expired(self):
|
def test_state_help_text_expired(self):
|
||||||
"""Tests if each domain state has help text when expired"""
|
"""Tests if each domain state has help text when expired"""
|
||||||
expired_text = "This domain has expired, but it is still online. "
|
expired_text = "This domain has expired. "
|
||||||
test_domain, _ = Domain.objects.get_or_create(name="expired.gov", state=Domain.State.READY)
|
test_domain, _ = Domain.objects.get_or_create(name="expired.gov", state=Domain.State.READY)
|
||||||
test_domain.expiration_date = date(2011, 10, 10)
|
test_domain.expiration_date = date(2011, 10, 10)
|
||||||
test_domain.save()
|
test_domain.save()
|
||||||
|
@ -240,7 +240,7 @@ class HomeTests(TestWithUser):
|
||||||
"""Tests if each domain state has help text when expiration date is None"""
|
"""Tests if each domain state has help text when expiration date is None"""
|
||||||
|
|
||||||
# == Test a expiration of None for state ready. This should be expired. == #
|
# == Test a expiration of None for state ready. This should be expired. == #
|
||||||
expired_text = "This domain has expired, but it is still online. "
|
expired_text = "This domain has expired. "
|
||||||
test_domain, _ = Domain.objects.get_or_create(name="imexpired.gov", state=Domain.State.READY)
|
test_domain, _ = Domain.objects.get_or_create(name="imexpired.gov", state=Domain.State.READY)
|
||||||
test_domain.expiration_date = None
|
test_domain.expiration_date = None
|
||||||
test_domain.save()
|
test_domain.save()
|
||||||
|
|
|
@ -439,15 +439,21 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
|
||||||
username="usertest",
|
username="usertest",
|
||||||
)
|
)
|
||||||
|
|
||||||
self.domaintorenew, _ = Domain.objects.get_or_create(
|
self.domain_to_renew, _ = Domain.objects.get_or_create(
|
||||||
name="domainrenewal.gov",
|
name="domainrenewal.gov",
|
||||||
)
|
)
|
||||||
|
|
||||||
UserDomainRole.objects.get_or_create(
|
self.domain_not_expiring, _ = Domain.objects.get_or_create(
|
||||||
user=self.user, domain=self.domaintorenew, role=UserDomainRole.Roles.MANAGER
|
name="domainnotexpiring.gov", expiration_date=timezone.now().date() + timedelta(days=65)
|
||||||
)
|
)
|
||||||
|
|
||||||
DomainInformation.objects.get_or_create(creator=self.user, domain=self.domaintorenew)
|
self.domain_no_domain_manager, _ = Domain.objects.get_or_create(name="domainnodomainmanager.gov")
|
||||||
|
|
||||||
|
UserDomainRole.objects.get_or_create(
|
||||||
|
user=self.user, domain=self.domain_to_renew, role=UserDomainRole.Roles.MANAGER
|
||||||
|
)
|
||||||
|
|
||||||
|
DomainInformation.objects.get_or_create(creator=self.user, domain=self.domain_to_renew)
|
||||||
|
|
||||||
self.portfolio, _ = Portfolio.objects.get_or_create(organization_name="Test org", creator=self.user)
|
self.portfolio, _ = Portfolio.objects.get_or_create(organization_name="Test org", creator=self.user)
|
||||||
|
|
||||||
|
@ -473,13 +479,15 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
|
||||||
|
|
||||||
@override_flag("domain_renewal", active=True)
|
@override_flag("domain_renewal", active=True)
|
||||||
def test_expiring_domain_on_detail_page_as_domain_manager(self):
|
def test_expiring_domain_on_detail_page_as_domain_manager(self):
|
||||||
|
"""If a user is a domain manager and their domain is expiring soon,
|
||||||
|
user should be able to see the "Renew to maintain access" link domain overview detail box."""
|
||||||
self.client.force_login(self.user)
|
self.client.force_login(self.user)
|
||||||
with patch.object(Domain, "is_expiring", self.custom_is_expiring), patch.object(
|
with patch.object(Domain, "is_expiring", self.custom_is_expiring), patch.object(
|
||||||
Domain, "is_expired", self.custom_is_expired_false
|
Domain, "is_expired", self.custom_is_expired_false
|
||||||
):
|
):
|
||||||
self.assertEquals(self.domaintorenew.state, Domain.State.UNKNOWN)
|
self.assertEquals(self.domain_to_renew.state, Domain.State.UNKNOWN)
|
||||||
detail_page = self.client.get(
|
detail_page = self.client.get(
|
||||||
reverse("domain", kwargs={"pk": self.domaintorenew.id}),
|
reverse("domain", kwargs={"pk": self.domain_to_renew.id}),
|
||||||
)
|
)
|
||||||
self.assertContains(detail_page, "Expiring soon")
|
self.assertContains(detail_page, "Expiring soon")
|
||||||
|
|
||||||
|
@ -491,6 +499,8 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
|
||||||
@override_flag("domain_renewal", active=True)
|
@override_flag("domain_renewal", active=True)
|
||||||
@override_flag("organization_feature", active=True)
|
@override_flag("organization_feature", active=True)
|
||||||
def test_expiring_domain_on_detail_page_in_org_model_as_a_non_domain_manager(self):
|
def test_expiring_domain_on_detail_page_in_org_model_as_a_non_domain_manager(self):
|
||||||
|
"""In org model: If a user is NOT a domain manager and their domain is expiring soon,
|
||||||
|
user be notified to contact a domain manager in the domain overview detail box."""
|
||||||
portfolio, _ = Portfolio.objects.get_or_create(organization_name="Test org", creator=self.user)
|
portfolio, _ = Portfolio.objects.get_or_create(organization_name="Test org", creator=self.user)
|
||||||
non_dom_manage_user = get_user_model().objects.create(
|
non_dom_manage_user = get_user_model().objects.create(
|
||||||
first_name="Non Domain",
|
first_name="Non Domain",
|
||||||
|
@ -510,9 +520,9 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
|
||||||
UserPortfolioPermissionChoices.VIEW_ALL_DOMAINS,
|
UserPortfolioPermissionChoices.VIEW_ALL_DOMAINS,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
domaintorenew2, _ = Domain.objects.get_or_create(name="bogusdomain2.gov")
|
domain_to_renew2, _ = Domain.objects.get_or_create(name="bogusdomain2.gov")
|
||||||
DomainInformation.objects.get_or_create(
|
DomainInformation.objects.get_or_create(
|
||||||
creator=non_dom_manage_user, domain=domaintorenew2, portfolio=self.portfolio
|
creator=non_dom_manage_user, domain=domain_to_renew2, portfolio=self.portfolio
|
||||||
)
|
)
|
||||||
non_dom_manage_user.refresh_from_db()
|
non_dom_manage_user.refresh_from_db()
|
||||||
self.client.force_login(non_dom_manage_user)
|
self.client.force_login(non_dom_manage_user)
|
||||||
|
@ -520,38 +530,42 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
|
||||||
Domain, "is_expired", self.custom_is_expired_false
|
Domain, "is_expired", self.custom_is_expired_false
|
||||||
):
|
):
|
||||||
detail_page = self.client.get(
|
detail_page = self.client.get(
|
||||||
reverse("domain", kwargs={"pk": domaintorenew2.id}),
|
reverse("domain", kwargs={"pk": domain_to_renew2.id}),
|
||||||
)
|
)
|
||||||
self.assertContains(detail_page, "Contact one of the listed domain managers to renew the domain.")
|
self.assertContains(detail_page, "Contact one of the listed domain managers to renew the domain.")
|
||||||
|
|
||||||
@override_flag("domain_renewal", active=True)
|
@override_flag("domain_renewal", active=True)
|
||||||
@override_flag("organization_feature", active=True)
|
@override_flag("organization_feature", active=True)
|
||||||
def test_expiring_domain_on_detail_page_in_org_model_as_a_domain_manager(self):
|
def test_expiring_domain_on_detail_page_in_org_model_as_a_domain_manager(self):
|
||||||
|
"""Inorg model: If a user is a domain manager and their domain is expiring soon,
|
||||||
|
user should be able to see the "Renew to maintain access" link domain overview detail box."""
|
||||||
portfolio, _ = Portfolio.objects.get_or_create(organization_name="Test org2", creator=self.user)
|
portfolio, _ = Portfolio.objects.get_or_create(organization_name="Test org2", creator=self.user)
|
||||||
|
|
||||||
domaintorenew3, _ = Domain.objects.get_or_create(name="bogusdomain3.gov")
|
domain_to_renew3, _ = Domain.objects.get_or_create(name="bogusdomain3.gov")
|
||||||
|
|
||||||
UserDomainRole.objects.get_or_create(user=self.user, domain=domaintorenew3, role=UserDomainRole.Roles.MANAGER)
|
UserDomainRole.objects.get_or_create(user=self.user, domain=domain_to_renew3, role=UserDomainRole.Roles.MANAGER)
|
||||||
DomainInformation.objects.get_or_create(creator=self.user, domain=domaintorenew3, portfolio=portfolio)
|
DomainInformation.objects.get_or_create(creator=self.user, domain=domain_to_renew3, portfolio=portfolio)
|
||||||
self.user.refresh_from_db()
|
self.user.refresh_from_db()
|
||||||
self.client.force_login(self.user)
|
self.client.force_login(self.user)
|
||||||
with patch.object(Domain, "is_expiring", self.custom_is_expiring), patch.object(
|
with patch.object(Domain, "is_expiring", self.custom_is_expiring), patch.object(
|
||||||
Domain, "is_expired", self.custom_is_expired_false
|
Domain, "is_expired", self.custom_is_expired_false
|
||||||
):
|
):
|
||||||
detail_page = self.client.get(
|
detail_page = self.client.get(
|
||||||
reverse("domain", kwargs={"pk": domaintorenew3.id}),
|
reverse("domain", kwargs={"pk": domain_to_renew3.id}),
|
||||||
)
|
)
|
||||||
self.assertContains(detail_page, "Renew to maintain access")
|
self.assertContains(detail_page, "Renew to maintain access")
|
||||||
|
|
||||||
@override_flag("domain_renewal", active=True)
|
@override_flag("domain_renewal", active=True)
|
||||||
def test_domain_renewal_form_and_sidebar_expiring(self):
|
def test_domain_renewal_form_and_sidebar_expiring(self):
|
||||||
|
"""If a user is a domain manager and their domain is expiring soon,
|
||||||
|
user should be able to see Renewal Form on the sidebar."""
|
||||||
self.client.force_login(self.user)
|
self.client.force_login(self.user)
|
||||||
with patch.object(Domain, "is_expiring", self.custom_is_expiring), patch.object(
|
with patch.object(Domain, "is_expiring", self.custom_is_expiring), patch.object(
|
||||||
Domain, "is_expiring", self.custom_is_expiring
|
Domain, "is_expiring", self.custom_is_expiring
|
||||||
):
|
):
|
||||||
# Grab the detail page
|
# Grab the detail page
|
||||||
detail_page = self.client.get(
|
detail_page = self.client.get(
|
||||||
reverse("domain", kwargs={"pk": self.domaintorenew.id}),
|
reverse("domain", kwargs={"pk": self.domain_to_renew.id}),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Make sure we see the link as a domain manager
|
# Make sure we see the link as a domain manager
|
||||||
|
@ -561,18 +575,19 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
|
||||||
self.assertContains(detail_page, "Renewal form")
|
self.assertContains(detail_page, "Renewal form")
|
||||||
|
|
||||||
# Grab link to the renewal page
|
# Grab link to the renewal page
|
||||||
renewal_form_url = reverse("domain-renewal", kwargs={"pk": self.domaintorenew.id})
|
renewal_form_url = reverse("domain-renewal", kwargs={"pk": self.domain_to_renew.id})
|
||||||
self.assertContains(detail_page, f'href="{renewal_form_url}"')
|
self.assertContains(detail_page, f'href="{renewal_form_url}"')
|
||||||
|
|
||||||
# Simulate clicking the link
|
# Simulate clicking the link
|
||||||
response = self.client.get(renewal_form_url)
|
response = self.client.get(renewal_form_url)
|
||||||
|
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertContains(response, f"Renew {self.domaintorenew.name}")
|
self.assertContains(response, f"Renew {self.domain_to_renew.name}")
|
||||||
|
|
||||||
@override_flag("domain_renewal", active=True)
|
@override_flag("domain_renewal", active=True)
|
||||||
def test_domain_renewal_form_and_sidebar_expired(self):
|
def test_domain_renewal_form_and_sidebar_expired(self):
|
||||||
|
"""If a user is a domain manager and their domain is expired,
|
||||||
|
user should be able to see Renewal Form on the sidebar."""
|
||||||
self.client.force_login(self.user)
|
self.client.force_login(self.user)
|
||||||
|
|
||||||
with patch.object(Domain, "is_expired", self.custom_is_expired_true), patch.object(
|
with patch.object(Domain, "is_expired", self.custom_is_expired_true), patch.object(
|
||||||
|
@ -580,10 +595,9 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
|
||||||
):
|
):
|
||||||
# Grab the detail page
|
# Grab the detail page
|
||||||
detail_page = self.client.get(
|
detail_page = self.client.get(
|
||||||
reverse("domain", kwargs={"pk": self.domaintorenew.id}),
|
reverse("domain", kwargs={"pk": self.domain_to_renew.id}),
|
||||||
)
|
)
|
||||||
|
|
||||||
print("puglesss", self.domaintorenew.is_expired)
|
|
||||||
# Make sure we see the link as a domain manager
|
# Make sure we see the link as a domain manager
|
||||||
self.assertContains(detail_page, "Renew to maintain access")
|
self.assertContains(detail_page, "Renew to maintain access")
|
||||||
|
|
||||||
|
@ -591,17 +605,19 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
|
||||||
self.assertContains(detail_page, "Renewal form")
|
self.assertContains(detail_page, "Renewal form")
|
||||||
|
|
||||||
# Grab link to the renewal page
|
# Grab link to the renewal page
|
||||||
renewal_form_url = reverse("domain-renewal", kwargs={"pk": self.domaintorenew.id})
|
renewal_form_url = reverse("domain-renewal", kwargs={"pk": self.domain_to_renew.id})
|
||||||
self.assertContains(detail_page, f'href="{renewal_form_url}"')
|
self.assertContains(detail_page, f'href="{renewal_form_url}"')
|
||||||
|
|
||||||
# Simulate clicking the link
|
# Simulate clicking the link
|
||||||
response = self.client.get(renewal_form_url)
|
response = self.client.get(renewal_form_url)
|
||||||
|
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertContains(response, f"Renew {self.domaintorenew.name}")
|
self.assertContains(response, f"Renew {self.domain_to_renew.name}")
|
||||||
|
|
||||||
@override_flag("domain_renewal", active=True)
|
@override_flag("domain_renewal", active=True)
|
||||||
def test_domain_renewal_form_your_contact_info_edit(self):
|
def test_domain_renewal_form_your_contact_info_edit(self):
|
||||||
|
"""Checking that if a user is a domain manager they can edit the
|
||||||
|
Your Profile portion of the Renewal Form."""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Start on the Renewal page for the domain
|
# Start on the Renewal page for the domain
|
||||||
renewal_page = self.app.get(reverse("domain-renewal", kwargs={"pk": self.domain_with_ip.id}))
|
renewal_page = self.app.get(reverse("domain-renewal", kwargs={"pk": self.domain_with_ip.id}))
|
||||||
|
@ -620,6 +636,8 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
|
||||||
|
|
||||||
@override_flag("domain_renewal", active=True)
|
@override_flag("domain_renewal", active=True)
|
||||||
def test_domain_renewal_form_security_email_edit(self):
|
def test_domain_renewal_form_security_email_edit(self):
|
||||||
|
"""Checking that if a user is a domain manager they can edit the
|
||||||
|
Security Email portion of the Renewal Form."""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Start on the Renewal page for the domain
|
# Start on the Renewal page for the domain
|
||||||
renewal_page = self.app.get(reverse("domain-renewal", kwargs={"pk": self.domain_with_ip.id}))
|
renewal_page = self.app.get(reverse("domain-renewal", kwargs={"pk": self.domain_with_ip.id}))
|
||||||
|
@ -641,6 +659,8 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
|
||||||
|
|
||||||
@override_flag("domain_renewal", active=True)
|
@override_flag("domain_renewal", active=True)
|
||||||
def test_domain_renewal_form_domain_manager_edit(self):
|
def test_domain_renewal_form_domain_manager_edit(self):
|
||||||
|
"""Checking that if a user is a domain manager they can edit the
|
||||||
|
Domain Manager portion of the Renewal Form."""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Start on the Renewal page for the domain
|
# Start on the Renewal page for the domain
|
||||||
renewal_page = self.app.get(reverse("domain-renewal", kwargs={"pk": self.domain_with_ip.id}))
|
renewal_page = self.app.get(reverse("domain-renewal", kwargs={"pk": self.domain_with_ip.id}))
|
||||||
|
@ -658,8 +678,26 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
|
||||||
self.assertContains(edit_page, "Domain managers can update all information related to a domain")
|
self.assertContains(edit_page, "Domain managers can update all information related to a domain")
|
||||||
|
|
||||||
@override_flag("domain_renewal", active=True)
|
@override_flag("domain_renewal", active=True)
|
||||||
def test_ack_checkbox_not_checked(self):
|
def test_domain_renewal_form_not_expired_or_expiring(self):
|
||||||
|
"""Checking that if the user's domain is not expired or expiring that user should not be able
|
||||||
|
to access /renewal and that it should receive a 403."""
|
||||||
|
with less_console_noise():
|
||||||
|
# Start on the Renewal page for the domain
|
||||||
|
renewal_page = self.client.get(reverse("domain-renewal", kwargs={"pk": self.domain_not_expiring.id}))
|
||||||
|
self.assertEqual(renewal_page.status_code, 403)
|
||||||
|
|
||||||
|
@override_flag("domain_renewal", active=True)
|
||||||
|
def test_domain_renewal_form_does_not_appear_if_not_domain_manager(self):
|
||||||
|
"""If user is not a domain manager and tries to access /renewal, user should receive a 403."""
|
||||||
|
with patch.object(Domain, "is_expired", self.custom_is_expired_true), patch.object(
|
||||||
|
Domain, "is_expired", self.custom_is_expired_true
|
||||||
|
):
|
||||||
|
renewal_page = self.client.get(reverse("domain-renewal", kwargs={"pk": self.domain_no_domain_manager.id}))
|
||||||
|
self.assertEqual(renewal_page.status_code, 403)
|
||||||
|
|
||||||
|
@override_flag("domain_renewal", active=True)
|
||||||
|
def test_ack_checkbox_not_checked(self):
|
||||||
|
"""If user don't check the checkbox, user should receive an error message."""
|
||||||
# Grab the renewal URL
|
# Grab the renewal URL
|
||||||
renewal_url = reverse("domain-renewal", kwargs={"pk": self.domain_with_ip.id})
|
renewal_url = reverse("domain-renewal", kwargs={"pk": self.domain_with_ip.id})
|
||||||
|
|
||||||
|
@ -671,7 +709,8 @@ class TestDomainDetailDomainRenewal(TestDomainOverview):
|
||||||
|
|
||||||
@override_flag("domain_renewal", active=True)
|
@override_flag("domain_renewal", active=True)
|
||||||
def test_ack_checkbox_checked(self):
|
def test_ack_checkbox_checked(self):
|
||||||
|
"""If user check the checkbox and submits the form,
|
||||||
|
user should be redirected Domain Over page with an updated by 1 year expiration date"""
|
||||||
# Grab the renewal URL
|
# Grab the renewal URL
|
||||||
with patch.object(Domain, "renew_domain", self.custom_renew_domain):
|
with patch.object(Domain, "renew_domain", self.custom_renew_domain):
|
||||||
renewal_url = reverse("domain-renewal", kwargs={"pk": self.domain_with_ip.id})
|
renewal_url = reverse("domain-renewal", kwargs={"pk": self.domain_with_ip.id})
|
||||||
|
@ -2866,11 +2905,11 @@ class TestDomainRenewal(TestWithUser):
|
||||||
name="igorville.gov", expiration_date=expiring_date
|
name="igorville.gov", expiration_date=expiring_date
|
||||||
)
|
)
|
||||||
self.domain_with_expired_date, _ = Domain.objects.get_or_create(
|
self.domain_with_expired_date, _ = Domain.objects.get_or_create(
|
||||||
name="domainwithexpireddate.com", expiration_date=expired_date
|
name="domainwithexpireddate.gov", expiration_date=expired_date
|
||||||
)
|
)
|
||||||
|
|
||||||
self.domain_with_current_date, _ = Domain.objects.get_or_create(
|
self.domain_with_current_date, _ = Domain.objects.get_or_create(
|
||||||
name="domainwithfarexpireddate.com", expiration_date=expiring_date_current
|
name="domainwithfarexpireddate.gov", expiration_date=expiring_date_current
|
||||||
)
|
)
|
||||||
|
|
||||||
UserDomainRole.objects.get_or_create(
|
UserDomainRole.objects.get_or_create(
|
||||||
|
@ -2916,7 +2955,7 @@ class TestDomainRenewal(TestWithUser):
|
||||||
today = datetime.now()
|
today = datetime.now()
|
||||||
expiring_date = (today + timedelta(days=30)).strftime("%Y-%m-%d")
|
expiring_date = (today + timedelta(days=30)).strftime("%Y-%m-%d")
|
||||||
self.domain_with_another_expiring, _ = Domain.objects.get_or_create(
|
self.domain_with_another_expiring, _ = Domain.objects.get_or_create(
|
||||||
name="domainwithanotherexpiringdate.com", expiration_date=expiring_date
|
name="domainwithanotherexpiringdate.gov", expiration_date=expiring_date
|
||||||
)
|
)
|
||||||
|
|
||||||
UserDomainRole.objects.get_or_create(
|
UserDomainRole.objects.get_or_create(
|
||||||
|
@ -2952,7 +2991,7 @@ class TestDomainRenewal(TestWithUser):
|
||||||
today = datetime.now()
|
today = datetime.now()
|
||||||
expiring_date = (today + timedelta(days=31)).strftime("%Y-%m-%d")
|
expiring_date = (today + timedelta(days=31)).strftime("%Y-%m-%d")
|
||||||
self.domain_with_another_expiring_org_model, _ = Domain.objects.get_or_create(
|
self.domain_with_another_expiring_org_model, _ = Domain.objects.get_or_create(
|
||||||
name="domainwithanotherexpiringdate_orgmodel.com", expiration_date=expiring_date
|
name="domainwithanotherexpiringdate_orgmodel.gov", expiration_date=expiring_date
|
||||||
)
|
)
|
||||||
|
|
||||||
UserDomainRole.objects.get_or_create(
|
UserDomainRole.objects.get_or_create(
|
||||||
|
|
|
@ -311,11 +311,39 @@ class DomainView(DomainBaseView):
|
||||||
self._update_session_with_domain()
|
self._update_session_with_domain()
|
||||||
|
|
||||||
|
|
||||||
class DomainRenewalView(DomainView):
|
class DomainRenewalView(DomainBaseView):
|
||||||
"""Domain detail overview page."""
|
"""Domain detail overview page."""
|
||||||
|
|
||||||
template_name = "domain_renewal.html"
|
template_name = "domain_renewal.html"
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
"""Grabs the security email information and adds security_email to the renewal form context
|
||||||
|
sets it to None if it uses a default email"""
|
||||||
|
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
|
||||||
|
default_emails = [DefaultEmail.PUBLIC_CONTACT_DEFAULT.value, DefaultEmail.LEGACY_DEFAULT.value]
|
||||||
|
|
||||||
|
context["hidden_security_emails"] = default_emails
|
||||||
|
|
||||||
|
security_email = self.object.get_security_email()
|
||||||
|
context["security_email"] = security_email
|
||||||
|
return context
|
||||||
|
|
||||||
|
def in_editable_state(self, pk):
|
||||||
|
"""Override in_editable_state from DomainPermission
|
||||||
|
Allow renewal form to be accessed
|
||||||
|
returns boolean"""
|
||||||
|
requested_domain = None
|
||||||
|
if Domain.objects.filter(id=pk).exists():
|
||||||
|
requested_domain = Domain.objects.get(id=pk)
|
||||||
|
|
||||||
|
return (
|
||||||
|
requested_domain
|
||||||
|
and requested_domain.is_editable()
|
||||||
|
and (requested_domain.is_expiring() or requested_domain.is_expired())
|
||||||
|
)
|
||||||
|
|
||||||
def post(self, request, pk):
|
def post(self, request, pk):
|
||||||
|
|
||||||
domain = get_object_or_404(Domain, id=pk)
|
domain = get_object_or_404(Domain, id=pk)
|
||||||
|
|
|
@ -192,7 +192,8 @@ class DomainPermission(PermissionsLoginMixin):
|
||||||
def can_access_domain_via_portfolio(self, pk):
|
def can_access_domain_via_portfolio(self, pk):
|
||||||
"""Most views should not allow permission to portfolio users.
|
"""Most views should not allow permission to portfolio users.
|
||||||
If particular views allow access to the domain pages, they will need to override
|
If particular views allow access to the domain pages, they will need to override
|
||||||
this function."""
|
this function.
|
||||||
|
"""
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def in_editable_state(self, pk):
|
def in_editable_state(self, pk):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue