File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ from zenodo_rdm.files import storage_factory
7373from zenodo_rdm.github.schemas import CitationMetadataSchema
7474from zenodo_rdm.legacy.resources import record_serializers
7575from zenodo_rdm.metrics.config import METRICS_CACHE_UPDATE_INTERVAL
76+ from zenodo_rdm.forms import ZenodoProfileForm
7677from zenodo_rdm.moderation.errors import UserBlockedException
7778from zenodo_rdm.moderation.handlers import CommunityModerationHandler, RecordModerationHandler
7879from zenodo_rdm.openaire.records.components import OpenAIREComponent
@@ -735,6 +736,8 @@ USERPROFILES_READ_ONLY = (
735736 False # allow users to change profile info (name, email, etc...)
736737)
737738
739+ USERPROFILES_FORM_CLASS = ZenodoProfileForm
740+
738741THEME_SHOW_FRONTPAGE_INTRO_SECTION = False
739742APP_RDM_RECORD_LANDING_PAGE_TEMPLATE = " zenodo_rdm/records/detail.html"
740743
Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ #
3+ # Copyright (C) 2023 CERN.
4+ #
5+ # Zenodo-RDM is free software; you can redistribute it and/or modify
6+ # it under the terms of the MIT License; see LICENSE file for more details.
7+ """Forms module."""
8+
9+ from .profile_form import ZenodoProfileForm
Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ #
3+ # Copyright (C) 2024 CERN.
4+ #
5+ # ZenodoRDM is free software; you can redistribute it and/or modify it
6+ # under the terms of the MIT License; see LICENSE file for more details.
7+
8+ """Form for user profiles."""
9+
10+ from invenio_i18n import lazy_gettext as _
11+ from invenio_userprofiles .forms import ProfileForm , strip_filter
12+ from wtforms import StringField , validators
13+ from wtforms .validators import DataRequired , EqualTo , Length
14+
15+
16+ class ZenodoProfileForm (ProfileForm ):
17+ """Form for editing user profile with stricter validation."""
18+
19+ full_name = StringField (
20+ _ ("Full name" ),
21+ validators = [
22+ Length (max = 255 ),
23+ DataRequired (message = _ ("Full name not provided." )),
24+ ],
25+ filters = [strip_filter ],
26+ )
27+
28+ affiliations = StringField (
29+ _ ("Affiliations" ),
30+ validators = [
31+ Length (max = 255 ),
32+ DataRequired (message = _ ("Affiliations not provided." )),
33+ ],
34+ filters = [strip_filter ],
35+ )
You can’t perform that action at this time.
0 commit comments