From 293416617a2e1c957e2148ef30038f850604e5e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ioan=20Biz=C4=83u?= Date: Thu, 25 Jan 2024 17:20:29 +0200 Subject: [PATCH] Ability to disable email verification. --- api/api.py | 10 +++++++--- api/config.py | 2 ++ install.sh | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/api/api.py b/api/api.py index eb04fac9..07d48740 100644 --- a/api/api.py +++ b/api/api.py @@ -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() diff --git a/api/config.py b/api/config.py index b73f1338..8dbcfc3b 100644 --- a/api/config.py +++ b/api/config.py @@ -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: diff --git a/install.sh b/install.sh index 9701c803..0c8c34d1 100644 --- a/install.sh +++ b/install.sh @@ -44,7 +44,7 @@ cd && mkdir -p plebeian-market-secrets tr -dc A-Za-z0-9 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 @@ -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