-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforms.py
More file actions
76 lines (63 loc) · 3.1 KB
/
Copy pathforms.py
File metadata and controls
76 lines (63 loc) · 3.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
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField
from wtforms.fields.simple import BooleanField
from wtforms.validators import DataRequired, Length, EqualTo, Email
class LoginForm(FlaskForm):
"""
Fields:
- username: User's unique identifier for login.
- password: User's password for authentication.
- submit: Button to submit the form.
Validation:
- username: Must be provided and between 4 to 25 characters.
- password: Must be provided.
"""
username = StringField('Username',
validators=[
DataRequired(message="Username is required."),
Length(min=4, max=25, message="Username must be between 4 and 25 characters.")])
password = PasswordField('Password',
validators=[DataRequired(message="Password is required.")])
submit = SubmitField('Login')
class RegistrationForm(FlaskForm):
"""
Fields:
- username: Desired unique username for the new user account.
- email: User's email address, used for communication and recovery.
- password: Desired password for the user account.
- confirm_password: Re-entry of password to confirm accuracy.
- is_admin: Checkbox option for admin registration (visible only to admins).
- is_admin: Checkbox option for resource registration (visible only to admins).
- submit: Button to submit the form.
Validation:
- username: Must be provided and between 3 to 20 characters.
- email: Must be provided and in a valid email format.
- password: Must be at least 6 characters long.
- confirm_password: Must match the password field.
"""
username = StringField('Username',
validators=[
DataRequired(message="Username is required."),
Length(min=3, max=20, message="Username must be between 3 and 20 characters.") ])
email = StringField('Email',
validators=[
DataRequired(message="Email is required."),
Email(message="Enter a valid email address.")])
password = PasswordField('Password',
validators=[
DataRequired(message="Password is required."),
Length(min=6, message="Password must be at least 6 characters.")])
confirm_password = PasswordField('Confirm Password',
validators=[
DataRequired(message="Please confirm your password."),
EqualTo('password', message="Passwords must match.")])
is_admin = BooleanField('Register as Admin')
is_resource = BooleanField('Register as Medical Resource')
submit = SubmitField('Register')
class BankDetailsForm(FlaskForm):
"""Information needed to build a Wise recipient + bank account."""
full_name = StringField('Account holder name', validators=[DataRequired()])
currency_needed = StringField('Payout currency (e.g. NGN, GHS, USD)', validators=[DataRequired(), Length(min=3, max=3)])
bank_account_number = StringField('Local account / IBAN', validators=[DataRequired()])
routing_number = StringField('Routing / Sort / BIC', validators=[Length(max=11)])
submit = SubmitField('Save')