diff --git a/CHANGES.rst b/CHANGES.rst
index 3480b8e7..7efef4fb 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -3,14 +3,21 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog `_,
and this project adheres to `Semantic Versioning `_.
-Fixed
+Added
*****
-- OIDC jwks endpoint do not return empty kid claim
+- If users register or authenticate during a OAuth Authorization
+ phase, they get redirected back to that page afterwards.
+ :issue:`168` :pr:`151`
[0.0.33] - 2023-08-26
=====================
+Fixed
+*****
+
+- OIDC jwks endpoint do not return empty kid claim
+
Added
*****
diff --git a/canaille/core/account.py b/canaille/core/account.py
index 44b19bf9..e3cbb726 100644
--- a/canaille/core/account.py
+++ b/canaille/core/account.py
@@ -34,6 +34,7 @@
from flask import redirect
from flask import request
from flask import send_file
+from flask import session
from flask import url_for
from flask_babel import gettext as _
from flask_babel import refresh
@@ -339,7 +340,12 @@ def registration(data=None, hash=None):
user = profile_create(current_app, form)
login_user(user)
flash(_("Your account has been created successfully."), "success")
- return redirect(url_for("core.account.profile_edition", edited_user=user))
+ return redirect(
+ session.pop(
+ "redirect-after-login",
+ url_for("core.account.profile_edition", edited_user=user),
+ )
+ )
@bp.route("/email-confirmation//")
diff --git a/canaille/core/auth.py b/canaille/core/auth.py
index 8be350cf..2e12d8eb 100644
--- a/canaille/core/auth.py
+++ b/canaille/core/auth.py
@@ -92,7 +92,7 @@ def password():
_("Connection successful. Welcome %(user)s", user=user.formatted_name[0]),
"success",
)
- return redirect(url_for("core.account.index"))
+ return redirect(session.pop("redirect-after-login", url_for("core.account.index")))
@bp.route("/logout")
@@ -214,6 +214,9 @@ def reset(user, hash):
login_user(user)
flash(_("Your password has been updated successfully"), "success")
- return redirect(url_for("core.account.profile_edition", edited_user=user))
+ return session.pop(
+ "redirect-after-login",
+ url_for("core.account.profile_edition", edited_user=user),
+ )
return render_template("reset-password.html", form=form, user=user, hash=hash)
diff --git a/canaille/core/forms.py b/canaille/core/forms.py
index 6bc21b42..6e76c623 100644
--- a/canaille/core/forms.py
+++ b/canaille/core/forms.py
@@ -74,10 +74,6 @@ class PasswordForm(Form):
)
-class FullLoginForm(LoginForm, PasswordForm):
- pass
-
-
class ForgottenPasswordForm(Form):
login = wtforms.StringField(
_("Login"),
diff --git a/canaille/core/templates/login.html b/canaille/core/templates/login.html
index 4406a2ed..a2799e84 100644
--- a/canaille/core/templates/login.html
+++ b/canaille/core/templates/login.html
@@ -27,10 +27,6 @@