diff --git a/demo/client/__init__.py b/demo/client/__init__.py
index 937b1b51..bd862b5f 100644
--- a/demo/client/__init__.py
+++ b/demo/client/__init__.py
@@ -25,6 +25,24 @@ def setup_routes(app):
"index.html", user=session.get("user"), name=app.config["NAME"]
)
+ @app.route("/register")
+ def register():
+ return oauth.canaille.authorize_redirect(
+ url_for("register_callback", _external=True), prompt="create"
+ )
+
+ @app.route("/register_callback")
+ def register_callback():
+ try:
+ token = oauth.canaille.authorize_access_token()
+ session["user"] = token.get("userinfo")
+ session["id_token"] = token["id_token"]
+ flash("You account has been successfully created.", "success")
+ except AuthlibBaseError as exc:
+ flash(f"An error happened during registration: {exc.description}", "error")
+
+ return redirect(url_for("index"))
+
@app.route("/login")
def login():
return oauth.canaille.authorize_redirect(
@@ -39,7 +57,7 @@ def setup_routes(app):
session["id_token"] = token["id_token"]
flash("You have been successfully logged in.", "success")
except AuthlibBaseError as exc:
- flash(f"You have not been logged in: {exc.description}", "error")
+ flash(f"An error happened during login: {exc.description}", "error")
return redirect(url_for("index"))
diff --git a/demo/client/templates/index.html b/demo/client/templates/index.html
index f39fd6fb..1061d550 100644
--- a/demo/client/templates/index.html
+++ b/demo/client/templates/index.html
@@ -118,7 +118,7 @@
Log out
-
+
{% else %}
@@ -126,9 +126,13 @@
Identity server
+
+ Sign up
+
+
Sign in
-
+
{% endif %}
diff --git a/demo/conf-docker/canaille-ldap.toml b/demo/conf-docker/canaille-ldap.toml
index 87e2228b..9efe8155 100644
--- a/demo/conf-docker/canaille-ldap.toml
+++ b/demo/conf-docker/canaille-ldap.toml
@@ -43,7 +43,7 @@ FAVICON = "/static/img/canaille-c.webp"
# 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 =
+EMAIL_CONFIRMATION = false
# If ENABLE_REGISTRATION is true, then users can freely create an account
# at this instance. If email verification is available, users must confirm
diff --git a/demo/conf-docker/canaille-memory.toml b/demo/conf-docker/canaille-memory.toml
index e2c472c7..37e3ad19 100644
--- a/demo/conf-docker/canaille-memory.toml
+++ b/demo/conf-docker/canaille-memory.toml
@@ -43,7 +43,7 @@ FAVICON = "/static/img/canaille-c.webp"
# 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 =
+EMAIL_CONFIRMATION = false
# If ENABLE_REGISTRATION is true, then users can freely create an account
# at this instance. If email verification is available, users must confirm
diff --git a/demo/conf-docker/canaille-sql.toml b/demo/conf-docker/canaille-sql.toml
index 8129e01a..8620cc0b 100644
--- a/demo/conf-docker/canaille-sql.toml
+++ b/demo/conf-docker/canaille-sql.toml
@@ -43,7 +43,7 @@ FAVICON = "/static/img/canaille-c.webp"
# 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 =
+EMAIL_CONFIRMATION = false
# If ENABLE_REGISTRATION is true, then users can freely create an account
# at this instance. If email verification is available, users must confirm
diff --git a/demo/conf/canaille-ldap.toml b/demo/conf/canaille-ldap.toml
index fa6c6a80..14054f42 100644
--- a/demo/conf/canaille-ldap.toml
+++ b/demo/conf/canaille-ldap.toml
@@ -43,7 +43,7 @@ FAVICON = "/static/img/canaille-c.webp"
# 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 =
+EMAIL_CONFIRMATION = false
# If ENABLE_REGISTRATION is true, then users can freely create an account
# at this instance. If email verification is available, users must confirm
diff --git a/demo/conf/canaille-memory.toml b/demo/conf/canaille-memory.toml
index 88633ad1..616f3d3d 100644
--- a/demo/conf/canaille-memory.toml
+++ b/demo/conf/canaille-memory.toml
@@ -43,7 +43,7 @@ FAVICON = "/static/img/canaille-c.webp"
# 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 =
+EMAIL_CONFIRMATION = false
# If ENABLE_REGISTRATION is true, then users can freely create an account
# at this instance. If email verification is available, users must confirm
diff --git a/demo/conf/canaille-sql.toml b/demo/conf/canaille-sql.toml
index 4307761b..6f24bf81 100644
--- a/demo/conf/canaille-sql.toml
+++ b/demo/conf/canaille-sql.toml
@@ -43,7 +43,7 @@ FAVICON = "/static/img/canaille-c.webp"
# 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 =
+EMAIL_CONFIRMATION = false
# If ENABLE_REGISTRATION is true, then users can freely create an account
# at this instance. If email verification is available, users must confirm
diff --git a/demo/demoapp.py b/demo/demoapp.py
index 97921c11..d214cbb4 100644
--- a/demo/demoapp.py
+++ b/demo/demoapp.py
@@ -107,7 +107,10 @@ def populate(app):
client_name="Client1",
contacts=["admin@mydomain.tld"],
client_uri="http://localhost:5001",
- redirect_uris=["http://localhost:5001/login_callback"],
+ redirect_uris=[
+ "http://localhost:5001/login_callback",
+ "http://localhost:5001/register_callback",
+ ],
post_logout_redirect_uris=["http://localhost:5001/logout_callback"],
tos_uri="http://localhost:5001/tos",
policy_uri="http://localhost:5001/policy",
@@ -127,7 +130,10 @@ def populate(app):
contacts=["admin@mydomain.tld"],
client_uri="http://localhost:5002",
redirect_uris=["http://localhost:5002/login_callback"],
- post_logout_redirect_uris=["http://localhost:5002/logout_callback"],
+ post_logout_redirect_uris=[
+ "http://localhost:5002/logout_callback",
+ "http://localhost:5002/register_callback",
+ ],
tos_uri="http://localhost:5002/tos",
policy_uri="http://localhost:5002/policy",
grant_types=["authorization_code", "refresh_token"],