-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforms.py
More file actions
367 lines (296 loc) · 10.1 KB
/
Copy pathforms.py
File metadata and controls
367 lines (296 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
from flask_wtf import FlaskForm
from wtforms import BooleanField, StringField, PasswordField, SelectField, RadioField, TextAreaField, HiddenField, SubmitField
from wtforms.validators import DataRequired, Email, Length, Regexp, Optional, EqualTo, URL
from flask_wtf.file import FileField, FileAllowed
from wtforms.widgets import TextArea
class RegistrationForm(FlaskForm):
"""Registration form for participants"""
full_name = StringField('Full Name', validators=[
DataRequired(),
Length(min=2, max=100)
])
email = StringField('Email', validators=[
DataRequired(),
Email(),
Length(max=100)
])
institution = StringField('Institution', validators=[
DataRequired(),
Length(min=2, max=200)
])
segment = SelectField('Segment', choices=[], validators=[DataRequired()])
division = SelectField('Division', choices=[], validators=[])
category = RadioField('Category', choices=[
('K', 'Kindergarten (K)'),
('P', 'Primary (P)'),
('J', 'Junior (J)'),
('S', 'Secondary (S)'),
('HS', 'Higher Secondary (HS)')
], validators=[Optional()])
submission_link = StringField('Submission Link', validators=[
Optional(),
URL(message="Enter a valid URL")
])
ca_ref = StringField('CA Reference', validators=[
Length(min=2),
Optional()
])
bkash_number = StringField('Bkash Number', validators=[
Optional(),
Regexp(r'^01[3-9]\d{8}$', message='Enter a valid Bangladesh mobile number')
])
transaction_id = StringField('Transaction ID', validators=[
Optional(),
Length(min=5, max=15)
])
receipt = FileField('Bkash Receipt Screenshot', validators=[
FileAllowed(['jpg', 'jpeg', 'png'], 'Images only! (jpg, jpeg, png)'),
Optional()
])
submit = SubmitField('Register')
# Hidden fields for bot prevention
honeypot = StringField('Honeypot', validators=[Optional()])
timestamp = HiddenField()
class CARegistrationForm(FlaskForm):
"""CA Registration Form"""
full_name = StringField('Full Name', validators=[
DataRequired(),
Length(min=2, max=100)
])
institution = StringField('Institution/University', validators=[
DataRequired(),
Length(min=2, max=200)
])
class_info = StringField('Class/Year', validators=[
DataRequired(),
Length(min=1, max=50)
])
phone = StringField('Phone Number', validators=[
DataRequired(),
Regexp(r'^01[3-9]\d{8}$', message='Enter a valid Bangladesh mobile number')
])
email = StringField('Email', validators=[
DataRequired(),
Email(),
Length(max=100)
])
why_ca = TextAreaField('Why do you want to be a CA?', validators=[
DataRequired(),
Length(min=20, max=1000)
], widget=TextArea(), render_kw={"rows": 6})
profile_picture = FileField('Profile Picture', validators=[
FileAllowed(['jpg', 'jpeg', 'png'], 'Images only! (jpg, jpeg, png)'),
DataRequired()
])
submit = SubmitField('Apply as CA')
class AdminLoginForm(FlaskForm):
"""Admin login form"""
email = StringField('Email', validators=[
DataRequired(),
Email()
])
password = PasswordField('Password', validators=[
DataRequired()
])
submit = SubmitField('Login')
class ContactForm(FlaskForm):
"""Contact form for inquiries"""
name = StringField('Your Name', validators=[
DataRequired(),
Length(min=2, max=100)
])
institution = StringField('Institution/Organization', validators=[
DataRequired(),
Length(min=2, max=200)
])
email = StringField('Email', validators=[
DataRequired(),
Email(),
Length(max=100)
])
message = TextAreaField('Message', validators=[
DataRequired(),
Length(min=10, max=2000)
], widget=TextArea(), render_kw={"rows": 6})
submit = SubmitField('Send Message')
class AdminUserForm(FlaskForm):
"""Form for adding admin users"""
name = StringField('Full Name', validators=[
DataRequired(),
Length(min=2, max=100)
])
email = StringField('Email', validators=[
DataRequired(),
Email(),
Length(max=100)
])
role = SelectField('Role', choices=[
('admin', 'Admin - Full Access'),
('executive', 'Executive - Management Access'),
('organizer', 'Organizer - View & Export Access'),
('moderator', 'Moderator - Basic View Access')
], validators=[DataRequired()])
password = PasswordField('Password', validators=[
DataRequired(),
Length(min=6, message='Password must be at least 6 characters')
])
confirm_password = PasswordField('Confirm Password', validators=[
DataRequired(),
EqualTo('password', message='Passwords must match')
])
submit = SubmitField('Add User')
class UserSignupForm(FlaskForm):
"""User Signup Form"""
full_name = StringField('Full Name', validators=[
DataRequired(),
Length(min=2, max=100)
])
address = StringField('Address', validators=[
Optional(),
Length(min=5, max=200)
])
email = StringField('Email', validators=[
DataRequired(),
Email(),
Length(max=100)
])
mobile = StringField('Mobile Number', validators=[
DataRequired(),
Regexp(r'^01[3-9]\d{8}$', message='Enter a valid Bangladesh mobile number')
])
institution = StringField('Institution/School', validators=[
DataRequired(),
Length(min=2, max=200)
])
class_level = SelectField('Class', choices=[
('', 'Select Class'),
('1', 'Class 1'),
('2', 'Class 2'),
('3', 'Class 3'),
('4', 'Class 4'),
('5', 'Class 5'),
('6', 'Class 6'),
('7', 'Class 7'),
('8', 'Class 8'),
('9', 'Class 9'),
('10', 'Class 10'),
('11', 'Class 11'),
('12', 'Class 12'),
], validators=[DataRequired()])
facebook_link = StringField('Facebook Profile Link (Required)', validators=[
Optional(),
URL(),
Length(max=200)
])
password = PasswordField('Password', validators=[
DataRequired(),
Length(min=8, message='Password must be at least 8 characters'),
Regexp(r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)',
message='Password must contain uppercase, lowercase, and numbers')
])
confirm_password = PasswordField('Confirm Password', validators=[
DataRequired(),
EqualTo('password', message='Passwords must match')
])
submit = SubmitField('Create Account')
class UserLoginForm(FlaskForm):
"""User Login Form"""
email = StringField('Email', validators=[
DataRequired(),
Email()
])
password = PasswordField('Password', validators=[
DataRequired()
])
remember = BooleanField('Remember Me')
submit = SubmitField('Login')
class ForgotPasswordForm(FlaskForm):
"""Forgot Password Form"""
email = StringField('Email', validators=[
DataRequired(),
Email()
])
submit = SubmitField('Send Reset Link')
class ProfileUpdateForm(FlaskForm):
"""Profile Update Form"""
full_name = StringField('Full Name', validators=[
DataRequired(),
Length(min=2, max=100)
])
address = StringField('Address', validators=[
DataRequired(),
Length(min=5, max=200)
])
mobile = StringField('Mobile Number', validators=[
DataRequired(),
Regexp(r'^01[3-9]\d{8}$', message='Enter a valid Bangladesh mobile number')
])
institution = StringField('Institution/School', validators=[
DataRequired(),
Length(min=2, max=200)
])
class_level = SelectField('Class', choices=[
('', 'Select Class'),
('1', 'Class 1'),
('2', 'Class 2'),
('3', 'Class 3'),
('4', 'Class 4'),
('5', 'Class 5'),
('6', 'Class 6'),
('7', 'Class 7'),
('8', 'Class 8'),
('9', 'Class 9'),
('10', 'Class 10'),
('11', 'Class 11'),
('12', 'Class 12'),
], validators=[DataRequired()])
facebook_link = StringField('Facebook Profile Link', validators=[
DataRequired(),
URL(),
Length(max=200)
])
submit = SubmitField('Update Profile')
class ChangePasswordForm(FlaskForm):
"""Change Password Form"""
current_password = PasswordField('Current Password', validators=[
DataRequired()
])
new_password = PasswordField('New Password', validators=[
DataRequired(),
Length(min=8, message='Password must be at least 8 characters'),
Regexp(r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)',
message='Password must contain uppercase, lowercase, and numbers')
])
confirm_new_password = PasswordField('Confirm New Password', validators=[
DataRequired(),
EqualTo('new_password', message='Passwords must match')
])
submit = SubmitField('Change Password')
class BobTicketForm(FlaskForm):
"""Ticket purchase form for Battle of the Bands"""
name = StringField('Full Name', validators=[
DataRequired(),
Length(min=2, max=100)
])
email = StringField('Email', validators=[
DataRequired(),
Email(),
Length(max=100)
])
institution = StringField('Institution', validators=[
DataRequired(),
Length(min=2, max=200)
])
class_level = StringField('Class', validators=[
DataRequired(),
Length(min=1, max=50)
])
bkash_number = StringField('Bkash Number', validators=[
DataRequired(),
Regexp(r'^01[3-9]\d{8}$', message='Enter a valid Bangladesh mobile number')
])
transaction_id = StringField('Transaction ID', validators=[
DataRequired(),
Length(min=5, max=50)
])
submit = SubmitField('Purchase Ticket')