Skip to content

Commit

Permalink
Ability to disable email verification.
Browse files Browse the repository at this point in the history
  • Loading branch information
ibz committed Jan 25, 2024
1 parent eb789a5 commit 2934166
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
10 changes: 7 additions & 3 deletions api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,13 @@ def put_me(user: m.User):
if m.User.query.filter_by(email=clean_email).one_or_none():
return jsonify({'message': "Somebody already registered this email address!"}), 400
user.email = clean_email
user.email_verified = False
user.generate_verification_phrase('email')
user.send_email_verification()

if app.config['USER_EMAIL_VERIFICATION']:
user.email_verified = False
user.generate_verification_phrase('email')
user.send_email_verification()
else:
user.email_verified = True

if 'telegram_username' in request.json:
clean_username = (request.json['telegram_username'] or "").lower().strip()
Expand Down
2 changes: 2 additions & 0 deletions api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
LNAUTH_EXPIRE_MINUTES = 120
JWT_EXPIRE_DAYS = 420

USER_EMAIL_VERIFICATION = bool(int(os.environ.get('USER_EMAIL_VERIFICATION', 1)))

MOCK_MAIL = bool(int(os.environ.get('MOCK_MAIL', 0)))
if not MOCK_MAIL:
with open("/secrets/mail.json") as f:
Expand Down
3 changes: 2 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ cd && mkdir -p plebeian-market-secrets
tr -dc A-Za-z0-9 </dev/urandom | head -c 64 > plebeian-market-secrets/secret_key
echo "{\"USERNAME\": \"pleb\", \"PASSWORD\": \"plebpass\"}" > plebeian-market-secrets/db.json
echo "{\"LNDHUB_URL\": \"https://ln.getalby.com\", \"LNDHUB_USER\": \"TODO\", \"LNDHUB_PASSWORD\": \"TODO\"}" > plebeian-market-secrets/lndhub.json
echo "{\"server\": \"\", \"username\": \"\", \"password\": \"\", \"default_sender\": \"hello@plebeian.market\"}" > plebeian-market-secrets/mail.json
echo "{\"server\": \"TODO\", \"username\": \"TODO\", \"password\": \"TODO\", \"default_sender\": \"hello@$DOMAIN_NAME\"}" > plebeian-market-secrets/mail.json

cd && mkdir -p plebeian-market-state/media

Expand All @@ -58,6 +58,7 @@ LOG_FILENAME=/state/pm.log
PROCESSED_EVENT_IDS_FILENAME=/state/processed_event_ids.txt
VERIFIED_EXTERNAL_IDENTITIES_FILENAME=/state/verified_external_identities.txt
GECKODRIVER_BINARY=/app/geckodriver
USER_EMAIL_VERIFICATION=0
EOF
echo "DOMAIN_NAME=$DOMAIN_NAME" >> .env
echo "WWW_BASE_URL=https://$DOMAIN_NAME" >> .env
Expand Down

0 comments on commit 2934166

Please sign in to comment.