Skip to content

Commit

Permalink
Merge branch 'issue-41-email-verification' into 'main'
Browse files Browse the repository at this point in the history
email verification

Closes #41

See merge request yaal/canaille!147
  • Loading branch information
azmeuk committed Aug 6, 2023
2 parents 29b1e3c + fd24c70 commit 2c588c4
Show file tree
Hide file tree
Showing 23 changed files with 1,243 additions and 242 deletions.
2 changes: 2 additions & 0 deletions canaille/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ def global_processor():
"user": current_user(),
"menu": True,
"is_boosted": request.headers.get("HX-Boosted", False),
"has_email_confirmation": app.config.get("EMAIL_CONFIRMATION") is True
or (app.config.get("EMAIL_CONFIRMATION") is None and "SMTP" in app.config),
}

@app.errorhandler(400)
Expand Down
2 changes: 1 addition & 1 deletion canaille/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def b64_to_obj(string):
return json.loads(base64.b64decode(string.encode("utf-8")).decode("utf-8"))


def profile_hash(*args):
def build_hash(*args):
return hashlib.sha256(
current_app.config["SECRET_KEY"].encode("utf-8")
+ obj_to_b64(args).encode("utf-8")
Expand Down
7 changes: 7 additions & 0 deletions canaille/config.sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ SECRET_KEY = "change me before you go in production"
# Accelerates webpages with async requests
# HTMX = true

# If EMAIL_CONFIRMATION is set to true, users will need to click on a
# confirmation link sent by email when they want to add a new email.
# By default, this is true if SMTP is configured, else this is false.
# If explicitely set to true and SMTP is disabled, the email field
# will be read-only.
# EMAIL_CONFIRMATION =

# If HIDE_INVALID_LOGINS is set to true (the default), when a user
# tries to sign in with an invalid login, a message is shown indicating
# that the password is wrong, but does not give a clue wether the login
Expand Down
Loading

0 comments on commit 2c588c4

Please sign in to comment.