Skip to content

Commit 666ba55

Browse files
Merge pull request #1425 from IFRCGo/develop
End-of-April Release
2 parents ef3ae4e + bb06356 commit 666ba55

File tree

9 files changed

+111
-17
lines changed

9 files changed

+111
-17
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## Unreleased
88

9+
## 1.1.441
10+
11+
### Added
12+
- Password policy enhancements
13+
- Return also visibility to event properties
14+
- EmergencyProject should have visibility itself
15+
16+
## 1.1.440
917
## 1.1.439
1018

1119
### Added
@@ -1975,7 +1983,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
19751983

19761984
## 0.1.20
19771985

1978-
[Unreleased]: https://github.com/IFRCGo/go-api/compare/1.1.439...HEAD
1986+
[Unreleased]: https://github.com/IFRCGo/go-api/compare/1.1.441...HEAD
1987+
[1.1.441]: https://github.com/IFRCGo/go-api/compare/1.1.440...1.1.441
1988+
[1.1.440]: https://github.com/IFRCGo/go-api/compare/1.1.439...1.1.440
19791989
[1.1.439]: https://github.com/IFRCGo/go-api/compare/1.1.438...1.1.439
19801990
[1.1.438]: https://github.com/IFRCGo/go-api/compare/1.1.437...1.1.438
19811991
[1.1.437]: https://github.com/IFRCGo/go-api/compare/1.1.436...1.1.437

api/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ class Meta:
666666
'is_featured_region', 'field_reports', 'hide_attached_field_reports', 'hide_field_report_map', 'updated_at',
667667
'id', 'slug', 'tab_one_title', 'ifrc_severity_level', 'ifrc_severity_level_display', 'parent_event', 'glide',
668668
'featured_documents', 'links', 'emergency_response_contact_email', 'countries_for_preview',
669-
'response_activity_count'
669+
'response_activity_count', 'visibility'
670670
)
671671
lookup_field = 'slug'
672672

api/snapshots/snap_test_views.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@
8383
'tab_one_title': 'XKANObFOIsPtEpZZRztDeSdkCAEDnvMjuTuUwziWxGJgupDhrC',
8484
'tab_three_title': 'zxczdKJmxJseyGCWJrNRNhigzxYvJxWjmMGzGccciTvZEHDjMG',
8585
'tab_two_title': 'pjgdsyNApkuKUumWkFGDFtFbfzGDpnLwddsFMPREsIagBiqUxW',
86-
'updated_at': '2008-01-01T00:00:00.123456Z'
86+
'updated_at': '2008-01-01T00:00:00.123456Z',
87+
'visibility': 3
8788
}
8889

8990
snapshots['EventSnaphostTest::test_event_link_api 1'] = {
@@ -157,5 +158,6 @@
157158
'tab_one_title': 'XKANObFOIsPtEpZZRztDeSdkCAEDnvMjuTuUwziWxGJgupDhrC',
158159
'tab_three_title': 'zxczdKJmxJseyGCWJrNRNhigzxYvJxWjmMGzGccciTvZEHDjMG',
159160
'tab_two_title': 'pjgdsyNApkuKUumWkFGDFtFbfzGDpnLwddsFMPREsIagBiqUxW',
160-
'updated_at': '2008-01-01T00:00:00.123456Z'
161+
'updated_at': '2008-01-01T00:00:00.123456Z',
162+
'visibility': 3
161163
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 2.2.27 on 2022-04-27 11:17
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('deployments', '0064_auto_20220414_0842'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='emergencyproject',
15+
name='visibility',
16+
field=models.CharField(choices=[('logged_in_user', 'Membership'), ('ifrc_only', 'IFRC Only'), ('public', 'Public'), ('ifrc_ns', 'IFRC_NS')], default='public', max_length=32, verbose_name='visibility'),
17+
),
18+
]

deployments/models.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,12 @@ class ActivityStatus(TextChoices):
653653
on_delete=models.CASCADE,
654654
related_name='+',
655655
) # Country to be among the country in event
656+
visibility = models.CharField(
657+
max_length=32,
658+
verbose_name=_('visibility'),
659+
choices=VisibilityCharChoices.CHOICES,
660+
default=VisibilityCharChoices.PUBLIC,
661+
)
656662

657663
def __str__(self):
658664
return self.title

deployments/serializers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ class EmergencyProjectSerializer(
534534
activity_lead_display = serializers.CharField(source='get_activity_lead_display', read_only=True)
535535
status_display = serializers.CharField(source='get_status_display', read_only=True)
536536
country_details = MiniCountrySerializer(source='country', read_only=True)
537+
visibility_display = serializers.CharField(source='get_visibility_display', read_only=True)
537538

538539
class Meta:
539540
model = EmergencyProject

main/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
from .celery import app as celery_app
44

55
__all__ = ['celery_app']
6-
__version__ = '1.1.439'
6+
__version__ = '1.1.441'

main/settings.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -245,18 +245,14 @@
245245
}
246246

247247
AUTH_PASSWORD_VALIDATORS = [
248-
{
249-
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
250-
},
251-
{
252-
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
253-
},
254-
{
255-
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
256-
},
257-
{
258-
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
259-
},
248+
{'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', },
249+
{'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', },
250+
{'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', },
251+
{'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', },
252+
{'NAME': 'main.validators.NumberValidator', },
253+
{'NAME': 'main.validators.UppercaseValidator', },
254+
{'NAME': 'main.validators.LowercaseValidator', },
255+
{'NAME': 'main.validators.SymbolValidator', },
260256
]
261257

262258
TINYMCE_DEFAULT_CONFIG = {

main/validators.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import re
2+
from django.core.exceptions import ValidationError
3+
from django.utils.translation import ugettext_lazy as _
4+
5+
6+
class NumberValidator(object):
7+
def validate(self, password, user=None):
8+
if not re.findall('\d', password):
9+
raise ValidationError(
10+
_("The password must contain at least 1 digit, 0-9."),
11+
code='password_no_number',
12+
)
13+
14+
def get_help_text(self):
15+
return _(
16+
"Your password must contain at least 1 digit, 0-9."
17+
)
18+
19+
20+
class UppercaseValidator(object):
21+
def validate(self, password, user=None):
22+
if not re.findall('[A-Z]', password):
23+
raise ValidationError(
24+
_("The password must contain at least 1 uppercase letter, A-Z."),
25+
code='password_no_upper',
26+
)
27+
28+
def get_help_text(self):
29+
return _(
30+
"Your password must contain at least 1 uppercase letter, A-Z."
31+
)
32+
33+
34+
class LowercaseValidator(object):
35+
def validate(self, password, user=None):
36+
if not re.findall('[a-z]', password):
37+
raise ValidationError(
38+
_("The password must contain at least 1 lowercase letter, a-z."),
39+
code='password_no_lower',
40+
)
41+
42+
def get_help_text(self):
43+
return _(
44+
"Your password must contain at least 1 lowercase letter, a-z."
45+
)
46+
47+
48+
class SymbolValidator(object):
49+
def validate(self, password, user=None):
50+
if not re.findall('[()[\]{}|\\`~!@#$%^&*_\-+=;:\'",<>./?]', password):
51+
raise ValidationError(
52+
_("The password must contain at least 1 symbol: " +
53+
"()[]{}|\`~!@#$%^&*_-+=;:'\",<>./?"),
54+
code='password_no_symbol',
55+
)
56+
57+
def get_help_text(self):
58+
return _(
59+
"Your password must contain at least 1 symbol: " +
60+
"()[]{}|\`~!@#$%^&*_-+=;:'\",<>./?"
61+
)

0 commit comments

Comments
 (0)