diff --git a/backend/app/api/v1/users.py b/backend/app/api/v1/users.py
index f4d6e30..5626eea 100644
--- a/backend/app/api/v1/users.py
+++ b/backend/app/api/v1/users.py
@@ -28,6 +28,15 @@ async def update_current_user_profile(
"""Update current user's profile"""
update_data = user_update.model_dump(exclude_unset=True)
+ # Check email uniqueness if email is being updated
+ if 'email' in update_data and update_data['email'] != current_user.email:
+ existing_user = db.query(User).filter(User.email == update_data['email']).first()
+ if existing_user:
+ raise HTTPException(
+ status_code=status.HTTP_400_BAD_REQUEST,
+ detail="Email already registered"
+ )
+
for field, value in update_data.items():
setattr(current_user, field, value)
diff --git a/backend/app/schemas/schemas.py b/backend/app/schemas/schemas.py
index 686f186..e514c75 100644
--- a/backend/app/schemas/schemas.py
+++ b/backend/app/schemas/schemas.py
@@ -18,6 +18,7 @@ class UserCreate(UserBase):
class UserUpdate(BaseModel):
+ email: Optional[EmailStr] = None
first_name: Optional[str] = Field(None, min_length=1, max_length=100)
last_name: Optional[str] = Field(None, min_length=1, max_length=100)
phone: Optional[str] = None
diff --git a/database/init.sql b/database/init.sql
index e3569c0..8ccdd2b 100644
--- a/database/init.sql
+++ b/database/init.sql
@@ -1,4 +1,7 @@
-- Initialize database with complete schema and default data
+-- Set character set to UTF-8 to prevent encoding issues
+SET NAMES utf8mb4;
+SET CHARACTER SET utf8mb4;
-- Create all tables
@@ -246,18 +249,18 @@ VALUES
'["first_name"]', TRUE, NOW(), NOW()),
('payment_confirmation', 'Payment Confirmation', 'Payment Confirmation - Swansea Airport Stakeholders Alliance',
- '
Payment Confirmed!
Hello {first_name},
We have received your payment. Thank you!
Amount: £{amount}
Payment Method: {payment_method}
Membership Tier: {membership_tier}
Your membership is now active. You can access all the benefits associated with your tier.
Best regards, Swansea Airport Stakeholders Alliance
',
- 'Payment Confirmed!\n\nHello {first_name},\n\nWe have received your payment. Thank you!\n\nAmount: £{amount}\nPayment Method: {payment_method}\nMembership Tier: {membership_tier}\n\nYour membership is now active. You can access all the benefits associated with your tier.\n\nBest regards,\nSwansea Airport Stakeholders Alliance',
+ '
Payment Confirmed!
Hello {first_name},
We have received your payment. Thank you!
Amount: {amount}
Payment Method: {payment_method}
Membership Tier: {membership_tier}
Your membership is now active. You can access all the benefits associated with your tier.
Best regards, Swansea Airport Stakeholders Alliance
',
+ 'Payment Confirmed!\n\nHello {first_name},\n\nWe have received your payment. Thank you!\n\nAmount: {amount}\nPayment Method: {payment_method}\nMembership Tier: {membership_tier}\n\nYour membership is now active. You can access all the benefits associated with your tier.\n\nBest regards,\nSwansea Airport Stakeholders Alliance',
'["first_name", "amount", "payment_method", "membership_tier"]', TRUE, NOW(), NOW()),
('membership_activation', 'Membership Activation', 'Your Swansea Airport Stakeholders Alliance Membership is Now Active!',
- '
Welcome to Swansea Airport Stakeholders Alliance!
Hello {first_name},
Great news! Your membership has been successfully activated. You now have full access to all the benefits of your membership tier.
Membership Details
Membership Tier: {membership_tier}
Annual Fee: £{annual_fee}
Next Renewal Date: {renewal_date}
Payment Information
Amount Paid: £{payment_amount}
Payment Method: {payment_method}
Payment Date: {payment_date}
Your membership will automatically renew on {renewal_date} unless you choose to cancel it. You can manage your membership settings in your account dashboard.
If you have any questions about your membership or need assistance, please don\'t hesitate to contact us.
Welcome to the Swansea Airport Stakeholders Alliance community!
Best regards, Swansea Airport Stakeholders Alliance Team
',
- 'Welcome to Swansea Airport Stakeholders Alliance!\n\nHello {first_name},\n\nGreat news! Your membership has been successfully activated. You now have full access to all the benefits of your membership tier.\n\nMEMBERSHIP DETAILS\n------------------\nMembership Tier: {membership_tier}\nAnnual Fee: £{annual_fee}\nNext Renewal Date: {renewal_date}\n\nPAYMENT INFORMATION\n-------------------\nAmount Paid: £{payment_amount}\nPayment Method: {payment_method}\nPayment Date: {payment_date}\n\nYour membership will automatically renew on {renewal_date} unless you choose to cancel it. You can manage your membership settings in your account dashboard.\n\nIf you have any questions about your membership or need assistance, please don\'t hesitate to contact us.\n\nWelcome to the Swansea Airport Stakeholders Alliance community!\n\nBest regards,\nSwansea Airport Stakeholders Alliance Team',
+ '
Welcome to Swansea Airport Stakeholders Alliance!
Hello {first_name},
Great news! Your membership has been successfully activated. You now have full access to all the benefits of your membership tier.
Membership Details
Membership Tier: {membership_tier}
Annual Fee: {annual_fee}
Next Renewal Date: {renewal_date}
Payment Information
Amount Paid: {payment_amount}
Payment Method: {payment_method}
Payment Date: {payment_date}
Your membership will automatically renew on {renewal_date} unless you choose to cancel it. You can manage your membership settings in your account dashboard.
If you have any questions about your membership or need assistance, please don\'t hesitate to contact us.
Welcome to the Swansea Airport Stakeholders Alliance community!
Best regards, Swansea Airport Stakeholders Alliance Team
',
+ 'Welcome to Swansea Airport Stakeholders Alliance!\n\nHello {first_name},\n\nGreat news! Your membership has been successfully activated. You now have full access to all the benefits of your membership tier.\n\nMEMBERSHIP DETAILS\n------------------\nMembership Tier: {membership_tier}\nAnnual Fee: {annual_fee}\nNext Renewal Date: {renewal_date}\n\nPAYMENT INFORMATION\n-------------------\nAmount Paid: {payment_amount}\nPayment Method: {payment_method}\nPayment Date: {payment_date}\n\nYour membership will automatically renew on {renewal_date} unless you choose to cancel it. You can manage your membership settings in your account dashboard.\n\nIf you have any questions about your membership or need assistance, please don\'t hesitate to contact us.\n\nWelcome to the Swansea Airport Stakeholders Alliance community!\n\nBest regards,\nSwansea Airport Stakeholders Alliance Team',
'["first_name", "membership_tier", "annual_fee", "payment_amount", "payment_method", "renewal_date", "payment_date"]', TRUE, NOW(), NOW()),
('renewal_reminder', 'Renewal Reminder', 'Membership Renewal Reminder - Swansea Airport Stakeholders Alliance',
- '
Membership Renewal Reminder
Hello {first_name},
This is a friendly reminder that your {membership_tier} membership will expire on {expiry_date}.
To continue enjoying your membership benefits, please renew your membership.
Membership Tier: {membership_tier}
Annual Fee: £{annual_fee}
Expires: {expiry_date}
Please log in to your account to renew your membership.
Best regards, Swansea Airport Stakeholders Alliance
',
- 'Membership Renewal Reminder\n\nHello {first_name},\n\nThis is a friendly reminder that your {membership_tier} membership will expire on {expiry_date}.\n\nTo continue enjoying your membership benefits, please renew your membership.\n\nMembership Tier: {membership_tier}\nAnnual Fee: £{annual_fee}\nExpires: {expiry_date}\n\nPlease log in to your account to renew your membership.\n\nBest regards,\nSwansea Airport Stakeholders Alliance',
+ '
Membership Renewal Reminder
Hello {first_name},
This is a friendly reminder that your {membership_tier} membership will expire on {expiry_date}.
To continue enjoying your membership benefits, please renew your membership.
Membership Tier: {membership_tier}
Annual Fee: {annual_fee}
Expires: {expiry_date}
Please log in to your account to renew your membership.
Best regards, Swansea Airport Stakeholders Alliance
',
+ 'Membership Renewal Reminder\n\nHello {first_name},\n\nThis is a friendly reminder that your {membership_tier} membership will expire on {expiry_date}.\n\nTo continue enjoying your membership benefits, please renew your membership.\n\nMembership Tier: {membership_tier}\nAnnual Fee: {annual_fee}\nExpires: {expiry_date}\n\nPlease log in to your account to renew your membership.\n\nBest regards,\nSwansea Airport Stakeholders Alliance',
'["first_name", "expiry_date", "membership_tier", "annual_fee"]', TRUE, NOW(), NOW()),
('password_reset', 'Password Reset', 'Password Reset Request - Swansea Airport Stakeholders Alliance Member Portal',
diff --git a/frontend/src/components/MembershipSetup.tsx b/frontend/src/components/MembershipSetup.tsx
index 9ea7a84..0099651 100644
--- a/frontend/src/components/MembershipSetup.tsx
+++ b/frontend/src/components/MembershipSetup.tsx
@@ -147,7 +147,7 @@ const MembershipSetup: React.FC = ({ onMembershipCreated,
Demo Payment
- This is a fake payment flow for demo purposes. Square will come soon
+ This is a Cash payment flow for demo purposes. Square / Paypal etc will come soon