Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
red_brick_board
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ciella Francisco
red_brick_board
Commits
d27f632c
Commit
d27f632c
authored
Mar 11, 2024
by
gab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added email validatior for ateneo emails
parent
fb455254
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
forms.py
redbrickboard/accounts/forms.py
+13
-1
No files found.
redbrickboard/accounts/forms.py
View file @
d27f632c
...
...
@@ -20,7 +20,19 @@ class CustomUserCreationForm(UserCreationForm):
class
Meta
:
model
=
CustomUser
fields
=
[
"email"
,
"first_name"
,
"last_name"
,
"password1"
,
"password2"
]
fields
=
[
"email"
,
"password1"
,
"password2"
,
"first_name"
,
"last_name"
,
"role"
,
"bio"
]
# This method runs automatically when forms are submitted, the email is an ateneo email address
def
clean_email
(
self
):
data
=
self
.
cleaned_data
[
'email'
]
if
"@ateneo.edu"
not
in
data
and
"@student.ateneo.edu"
not
in
data
and
"@alumni.ateneo.edu"
not
in
data
:
raise
forms
.
ValidationError
(
"Must be an ateneo email address"
)
return
data
# class CustomUserCreationForm(forms.ModelForm):
# email = forms.EmailField(widget=forms.EmailInput(attrs={'autofocus': True}))
# password = forms.CharField(widget=PasswordInput())
# class CustomUserChangeForm(UserChangeForm):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment