Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • andretol/greg
1 result
Show changes
Commits on Source (6)
......@@ -30,7 +30,18 @@ function getHeaderLogo() {
/>
)
case 'uib':
return <></>
if (i18n.language === 'en') {
return (
<UiBLogoEn
style={{ minHeight: '7rem', minWidth: '10rem', maxWidth: '30rem' }}
/>
)
}
return (
<UiBLogoNo
style={{ minHeight: '7rem', minWidth: '10rem', maxWidth: '30rem' }}
/>
)
default:
return <></>
}
......@@ -54,18 +65,8 @@ function getFooterLogo() {
/>
)
case 'uib':
if (i18n.language === 'en') {
return (
<UiBLogoEn
style={{ minHeight: '7rem', minWidth: '10rem', maxWidth: '30rem' }}
/>
)
}
return (
<UiBLogoNo
style={{ minHeight: '7rem', minWidth: '10rem', maxWidth: '30rem' }}
/>
)
// No footer logo defined for UiB
return <></>
default:
return <></>
}
......
import { ThemeOptions } from '@mui/material'
/*
Based on guidelines found here: https://manual.uib.no/profilmanual/profilelementer/
UiB style guide: https://manual.uib.no/profilmanual/profilelementer/
The secondary colours are the same as UiO, since these have good contrast
and we do have to only use UiB-colours as long as the overall look of
the pages look similar to other UiB web-sites
*/
const uibTheme: ThemeOptions = {
greg: {
......@@ -17,7 +21,9 @@ const uibTheme: ThemeOptions = {
light: '#ff6c6a',
},
secondary: {
main: '#4ea0b7',
main: '#01579B',
dark: '#1565c0',
light: '#A4C8E4',
},
},
}
......
......@@ -304,3 +304,15 @@ ORGREG_EXTRA_IDS = []
# Acronyms to be imported as identifiers from orgreg. List of acronym values, supported ones are: nob, nno, eng
# Example list: ["nob"]
ORGREG_ACRONYMS = []
# Settings related to Django-q used for scheduling tasks in the future.
# We use it to queue creation of Notification objects related to roles when start/end dates are in the future
Q_CLUSTER = {
"name": "greg",
"workers": 4,
"timeout": 90,
"retry": 120,
"queue_limit": 50,
"bulk": 10,
"orm": "default",
}
......@@ -30,16 +30,12 @@ CEREBRUM_CLIENT = {
}
CEREBRUM_HIERARCHICAL_ACCESS = True
Q_CLUSTER = {
"name": "greg",
"workers": 4,
"timeout": 90,
"retry": 120,
"queue_limit": 50,
"bulk": 10,
"orm": "default",
"sync": True,
}
Q_CLUSTER.update(
{
"sync": True,
}
)
AUTHENTICATION_BACKENDS = [
"gregui.authentication.auth_backends.DevBackend", # Fake dev backend
......
......@@ -21,7 +21,7 @@ from greg.permissions import IsSponsor
from greg.utils import get_default_invitation_expire_date_from_now
from gregui.api.serializers.guest import GuestRegisterSerializer
from gregui.api.serializers.invitation import InviteGuestSerializer
from gregui.mailutils import send_invite_mail
from gregui.mailutils import send_confirmation_mail_from_link, send_invite_mail
from gregui.models import GregUserProfile
logger = structlog.getLogger(__name__)
......@@ -328,7 +328,9 @@ class InvitedGuestView(GenericAPIView):
# Expire the invite link
invite_link.expire = timezone.now()
invite_link.save()
# TODO: Send an email to the sponsor?
# Send an email to the sponsor
send_confirmation_mail_from_link(invite_link)
return Response(status=status.HTTP_200_OK)
@staticmethod
......
......@@ -82,3 +82,10 @@ def send_invite_mail(link: InvitationLink) -> Optional[str]:
return send_registration_mail(
email_address.value, f"{sponsor.first_name} {sponsor.last_name}"
)
def send_confirmation_mail_from_link(link: InvitationLink) -> Optional[str]:
email_address = link.invitation.role.sponsor.work_email
guest = link.invitation.role.person
guest_name = f"{guest.first_name} {guest.last_name}"
return send_confirmation_mail(email_address, guest_name)
......@@ -129,7 +129,9 @@ def test_get_invited_info_expired_link(
@pytest.mark.django_db
def test_invited_guest_can_post_information(client: APIClient, invited_person):
def test_invited_guest_can_post_information(
client: APIClient, invited_person, confirmation_template
):
person, invitation_link = invited_person
# get a session
client.post(
......@@ -217,7 +219,9 @@ def test_post_invited_info_invalid_national_id_number(client, invited_person):
@pytest.mark.django_db
def test_post_invited_info_valid_national_id_number(client, invited_person):
def test_post_invited_info_valid_national_id_number(
client, invited_person, confirmation_template
):
person, invitation_link = invited_person
fnr = "11120618212"
data = {
......@@ -243,7 +247,7 @@ def test_post_invited_info_valid_national_id_number(client, invited_person):
@pytest.mark.django_db
def test_email_update(client, invited_person):
def test_email_update(client, invited_person, confirmation_template):
person, invitation_link = invited_person
email_test = person.private_email.value
url = reverse("gregui-v1:invited-info")
......@@ -264,7 +268,7 @@ def test_email_update(client, invited_person):
@pytest.mark.django_db
def test_register_passport(client, invited_person):
def test_register_passport(client, invited_person, confirmation_template):
person, invitation_link = invited_person
passport_information = "EN-123456789"
data = {"person": {"mobile_phone": "+4797543992", "passport": passport_information}}
......@@ -350,6 +354,7 @@ def test_name_update_allowed_if_feide_identity_is_not_present(
create_invitation,
create_invitation_link,
invitation_valid_date,
confirmation_template,
):
# This person does not have a Feide ID, so he will be viewed as someone whose name was entered manually
# by the sponsor, and in it that case the guest can update it
......@@ -427,7 +432,9 @@ def test_post_info_fail_unknown_field(client, invited_person_verified_nin):
@pytest.mark.django_db
def test_date_of_birth_stored(client, invited_person_verified_nin):
def test_date_of_birth_stored(
client, invited_person_verified_nin, confirmation_template
):
_, invitation_link = invited_person_verified_nin
session = client.session
......@@ -468,7 +475,9 @@ def test_invalid_date_of_birth_rejected(client, invited_person_verified_nin):
@pytest.mark.django_db
def test_saves_consents(client, invited_person, consent_type_foo, consent_type_bar):
def test_saves_consents(
client, invited_person, consent_type_foo, consent_type_bar, confirmation_template
):
person, invitation_link = invited_person
fnr = "11120618212"
......@@ -502,7 +511,7 @@ def test_saves_consents(client, invited_person, consent_type_foo, consent_type_b
@pytest.mark.django_db
def test_post_invited_info_valid_dnumber(client, invited_person):
def test_post_invited_info_valid_dnumber(client, invited_person, confirmation_template):
person, invitation_link = invited_person
d_number = "53097248016"
data = {
......@@ -528,7 +537,7 @@ def test_post_invited_info_valid_dnumber(client, invited_person):
@pytest.mark.django_db
def test_gender_stored(client, invited_person_verified_nin):
def test_gender_stored(client, invited_person_verified_nin, confirmation_template):
_, invitation_link = invited_person_verified_nin
session = client.session
......@@ -553,7 +562,9 @@ def test_gender_stored(client, invited_person_verified_nin):
@pytest.mark.django_db
def test_gender_blank_allowed(client, invited_person_verified_nin):
def test_gender_blank_allowed(
client, invited_person_verified_nin, confirmation_template
):
_, invitation_link = invited_person_verified_nin
session = client.session
......
......@@ -76,3 +76,12 @@ def test_send_invite_mail_no_mail(invited_person):
assert len(mail.outbox) == 0
assert mailutils.send_invite_mail(link) is None
assert len(mail.outbox) == 0
@pytest.mark.django_db
def test_confirmation_mail_from_link(invited_person, confirmation_template):
mail.outbox = []
_, link = invited_person
assert len(mail.outbox) == 0
assert mailutils.send_confirmation_mail_from_link(link)
assert len(mail.outbox) == 1