Commit Graph

36 Commits

Author SHA1 Message Date
stvnrlly
f49e2a9e6e more gray for dashboard 2022-12-01 10:18:12 -05:00
stvnrlly
8990cc822c styling fixes 2022-11-29 12:18:07 -05:00
stvnrlly
446694d1cc put timezone dt in config 2022-11-29 10:58:59 -05:00
stvnrlly
d45cbb2c86 util for naive dt parsing 2022-11-28 20:40:53 -05:00
stvnrlly
e12e780a05 code cleanup 2022-11-28 15:53:56 -05:00
stvnrlly
8bd1285bfa more test fixes 2022-11-28 10:48:51 -05:00
stvnrlly
ca1897973a test time fixes and bonus letter removal 2022-11-22 17:03:42 -05:00
stvnrlly
46723b6c11 initial timezone pass, which breaks many tests 2022-11-22 12:00:29 -05:00
stvnrlly
218eb3559f Merge branch 'main' into stvnrlly-remove-broadcasts 2022-10-26 01:27:44 +00:00
stvnrlly
f16b5dd1c4 remove broadcast-related code 2022-10-04 03:04:13 +00:00
stvnrlly
3e7b5b4370 update tests based on updated orgs 2022-09-15 18:47:04 +00:00
Jim Moffet
2b727e13b4 local dev upgrades 2022-06-13 14:26:46 -07:00
Ben Thorner
6030e9e5bb Decouple the set of org types from their labels
In response to: [^1].

[^1]: https://github.com/alphagov/notifications-admin/pull/4196#discussion_r838383086
2022-03-30 17:46:53 +01:00
Ben Thorner
8a7eed9b26 Minor refactorings to help read branding rules
I did consider having a "has_govuk_branding" variable, but I think
it's better to reinforce what this means with comments.
2022-03-30 17:46:42 +01:00
Ben Thorner
1cc5413f96 Move and clarify "NHS_BRANDING_ID" constant
This is specific to email branding [^1]. Using the name to match
the current branding is more error-prone.

[^1]: a165f62b60
2022-03-30 17:46:41 +01:00
Ben Thorner
21eea0189d DRY-up listing NHS organisation types
The model should be the source of truth for this.
2022-03-30 17:46:40 +01:00
Ben Thorner
8f55972aae Split "get_available_choices" by branding type
We already had different functionality for email branding and will
soon be adding more for email branding pools.

Note that the "get_available_choices" class method was only used for
email branding - we can do it in the constructor for letters.
2022-03-30 17:46:39 +01:00
Ben Thorner
2fc0a105f4 Move branding choices logic into utility module
This was a lot of code to be in a form and it's going to get even
more complicated with email branding pools. Moving it out means we
can also simplify the tests that target this code.
2022-03-15 11:47:16 +00:00
Chris Hill-Scott
4f672cb5dc Make logo CDN domain into simple config
Having this as a function which does string parsing and manipulation
surprised me a bit when I was trying to figure out why something wasn’t
working.

It’s more in line with the way we do other config like this (for example
`ASSET_PATH`) to make it a simple config variable, rather than trying to
be clever and guess things based on other config variables.

It’s also less code, and is explicit enough that it doesn’t need tests.
2022-01-27 10:33:05 +00:00
Katie Smith
812aa3ffe8 Add hscni.net to list of allowed domains
We can't assign `hscni.net` to an organisation because it is used
by GP surgeries, so we don't always know which org it should be
associated with. This change allows people with the an `hscni.net`
email address to sign up and create a service.
2021-12-20 11:41:10 +00:00
Chris Hill-Scott
5c1920fc20 Remove old method of updating email_access_validated_at
Previously we were passing a flag to the API which handled this. Now
we are doing it at the time of clicking the link, not at the time of
storing the new password. We don’t need to update the timestamp twice,
so this commit removes the code which tells the API to do it.
2021-08-19 11:14:47 +01:00
Leo Hemsted
71d3aa13d7 follow sign_in redirect even if you're already signed in 2021-08-17 14:44:09 +01:00
Ben Thorner
dcfff87cc0 Continue to remove "roles" terminology
This renames the two functions we have to translate between UI and
DB permissions, as well as some of their associated variables to
make it clearer which kind of permission they contain.
2021-07-28 12:37:17 +01:00
Ben Thorner
ba9865e62e Start to remove use of the term "roles"
We don't use this term consistently and it's not defined anywhere.
Since most of the Admin app deals with user-facing permssions, it's
OK to just use the term "permissions". Where both types of permission
are present in the same file, we can more clearly distinguish them
as "UI permissions" and "DB permissions".
2021-07-28 12:37:16 +01:00
Ben Thorner
a38baa0bd8 Rename unclear "permissions" attributes
These are more than a list of permissions: each item includes the
label to use when displaying it as an option on a form. Switching
to a name that reflects how the attributes are used will help to
avoid confusion when we rename some of the other attributes in the
same file in later commits.
2021-07-28 12:37:15 +01:00
Ben Thorner
1127a03c32 Move and rename roles_and_permissions.py
This file does not represent a model, but rather a set of utilities
that are specific to user permissions (vs. service permissions).
2021-07-28 12:36:40 +01:00
Leo Hemsted
5da69dd495 dont let people get into one-off flow for deleted templates
previously we'd skip the template page entirely if someone didnt have
manage templates/api keys permission. however, if the template is
deleted you'd then go through the flow entering placeholders and stuff
before it would then crash when trying to send.

instead, just bounce the user to the template page. It has the content
and says when the template was deleted.
2021-07-22 11:47:07 +01:00
Chris Hill-Scott
c3091223a9 Be strict about similar email addresses for alerts
We don’t want a single person to have two accounts on an emergency
alerts service because it would let them circumvent the two eyes
approval process.

We can go some way to mitigating against this by stopping people using
common methods that email providers use to alias email addresses. These
are:
- being case insensitive
- being insensitive to the position or number of dots in the local part
  of an email address
- using ‘plus addressing’

We already prevent the first one, this commit adds normalisation which
strip out the second two before doing the comparision with the current
user’s email address.
2021-07-15 13:55:50 +01:00
Ben Thorner
c17d438de8 DRY-up email revalidation check
Previously this was duplicated between the "two_factor" and the
"webauthn" views, and required more test setup. This DRYs up the
check and tests it once, using mocks to simplify the view tests.

As part of DRYing up the check into a util module, I've also moved
the "is_less_than_days_ago" function it uses.
2021-06-14 12:52:54 +01:00
Ben Thorner
bf2e6802bf Extract login utils out of two_factor view
This better reflects how the code is reused in other views and is
not specific to two factor actions. We have a pattern of testing
utility functionality for each view (as opposed to testing the util
+ the view calls the util), so I'm leaving the tests as-is.
2021-06-14 11:19:06 +01:00
Ben Thorner
3250f2b3ed Move redirect_to_signin helper to new util module
We'll expand this module in later commits.
2021-06-14 11:09:42 +01:00
Ben Thorner
edb0b8214d Move pagination utils into own module
This continues the pattern established in [1], just to chip away a
bit more at the random collection of stuff in utils/__init__.py.

[1]: https://github.com/alphagov/notifications-admin/pull/3923
2021-06-14 11:00:05 +01:00
Ben Thorner
0326005aeb Extract template / csv utility code into modules
This follows a similar approach to the previous commits, noting that
one module depends on the other, so we have to extract both together.
2021-06-09 15:19:00 +01:00
Ben Thorner
2a4aa8b4e1 Extract letter utility code into own module
This provides more room for expansion, and reduces the amount of
arbitrary code in the __init__.py file for the new package.
2021-06-09 13:59:06 +01:00
Ben Thorner
7c27646d6a Extract user utility code into own module
This provides more room for expansion, and reduces the amount of
arbitrary code in the __init__.py file for the new package.
2021-06-09 13:19:05 +01:00
Ben Thorner
3f55c746aa Turn utils into a module
This provides more room for expansion, so we don't get another
massive file to scroll through. We do also have some top-level
files, such as "formatters.py", which we could consider moving
under utils/ in future.
2021-06-09 12:50:01 +01:00