Skip to content

Commit b2c38ff

Browse files
committed
Finish changing user-facing login templates to use Social Login
Did a sweep through docs and made some wording improvements.
1 parent 7198e2c commit b2c38ff

6 files changed

Lines changed: 18 additions & 11 deletions

File tree

docs/api.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ sends the following signals.
290290

291291
.. data:: user_unauthenticated
292292

293-
Sent when a user fails to authenticate. It is sent from the `default_unauthn_handler`.
293+
Sent when a user accesses a protected endpoint but isn't properly authenticated.
294+
It is sent as part of the `default_unauthn_handler` (:meth:`.Security.unauthn_handler`)
294295
It is passed the app (which is the sender).
295296

296297
.. versionadded:: 5.4.0

docs/configuration.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ These configuration keys are used globally across all features.
172172

173173
.. py:data:: SECURITY_REDIRECT_BEHAVIOR
174174
175-
Passwordless login, confirmation, reset password, unified signin, change_email, and OAuth signin
175+
Passwordless login, confirmation, reset password, unified signin, change_email, and Social Login
176176
have GET endpoints that validate the passed token and redirect to an action form.
177177
For Single-Page-Applications style UIs which need to control their own internal URL routing these redirects
178178
need to not contain forms, but contain relevant information as query parameters.
@@ -225,7 +225,7 @@ These configuration keys are used globally across all features.
225225
.. py:data:: SECURITY_REDIRECT_BASE_DOMAIN
226226
227227
Set the base domain for checking allowable redirects. The intent here is to
228-
allow an application to be server on e.g. "flaskapp.my.org" and redirect
228+
allow an application to be served on e.g. "flaskapp.my.org" and redirect
229229
to "myservice.my.org" (which maybe isn't a Flask app). Flask's SERVER_NAME
230230
can't be used to verify redirects in this case. Note that in most cases
231231
the application will want to set Flask's SESSION_COOKIE_DOMAIN to be this base domain -
@@ -422,6 +422,7 @@ These configuration keys are used globally across all features.
422422
- :py:data:`SECURITY_WAN_DELETE_URL`
423423
- :py:data:`SECURITY_MULTI_FACTOR_RECOVERY_CODES`
424424
- :py:data:`SECURITY_CHANGE_EMAIL_URL`
425+
- :py:data:`SECURITY_CHANGE_USERNAME_URL`
425426

426427
This can also be used to protect application endpoints with the :meth:`flask_security.auth_required` decorator.
427428

flask_security/core.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,7 +2023,7 @@ def unauthz_handler(
20232023
Can raise an exception if it is handled as part of
20242024
flask.errorhandler(<exception>)
20252025
2026-
With the passed parameters the application could deliver a concise error
2026+
With the passed parameters, the application could deliver a concise error
20272027
message.
20282028
20292029
.. versionadded:: 3.3.0
@@ -2038,7 +2038,8 @@ def unauthn_handler(
20382038
cb: t.Callable[[list[str], dict[str, str] | None], ResponseValue],
20392039
) -> None:
20402040
"""
2041-
Callback for failed authentication.
2041+
Callback when a protected endpoint is accessed without the required
2042+
authentication.
20422043
This is called by :func:`auth_required`, :func:`auth_token_required`
20432044
or :func:`http_auth_required` if authentication fails.
20442045
It is also called from Flask-Login's @login_required decorator.
@@ -2053,7 +2054,8 @@ def unauthn_handler(
20532054
``flask.errorhandler(<exception>)``
20542055
20552056
The default implementation will return a 401 response if the request was JSON,
2056-
otherwise will redirect to the `login` view.
2057+
otherwise will redirect to the `login` view. In addition, the
2058+
:data:`user_unauthenticated` signal is sent.
20572059
20582060
.. versionadded:: 3.3.0
20592061

flask_security/decorators.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@
5050

5151

5252
def default_unauthn_handler(mechanisms=None, headers=None):
53-
"""Default callback for failures to authenticate
53+
"""Default callback when a protected endpoint is accessed without the required
54+
authentication.
55+
56+
The :data:`user_unauthenticated` signal is sent.
5457
5558
If caller wants JSON - return 401.
5659
If caller wants BasicAuth - return 401 (the WWW-Authenticate header is set).

flask_security/templates/security/login_user.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ <h2>{{ _fsdomain("Use a Passkey to Sign In") }}</h2>
3030
{% endif %}
3131
{% if security.oauthglue %}
3232
<hr class="fs-gap">
33-
<h2>{{ _fsdomain("Use Social OAuth to Sign In") }}</h2>
33+
<h2>{{ _fsdomain("Use Social Login to Sign In") }}</h2>
3434
{% for provider in security.oauthglue.provider_names %}
3535
<div class="fs-gap">
3636
<form method="post" id="{{ provider }}_form" name="{{ provider }}_form">
37-
<input id="{{ provider }}" name="{{ provider }}" type="submit" value="{{ _fsdomain('Sign in with %(provider)s', provider=provider) }}" formaction="{{ url_for_security('oauthstart', name=provider) }}{{ prop_next() }}">
37+
<input id="{{ provider }}" name="{{ provider }}" type="submit" value="{{ _fsdomain('Continue with %(provider)s', provider=provider) }}" formaction="{{ url_for_security('oauthstart', name=provider) }}{{ prop_next() }}">
3838
{% if csrf_token is defined %}
3939
<input id="{{ provider }}_csrf_token" name="{{ provider }}_csrf_token" type="hidden" value="{{ csrf_token() }}">
4040
{% endif %}

flask_security/templates/security/us_signin.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ <h2>{{ _fsdomain("Use a Passkey to Sign In") }}</h2>
3232
{% endif %}
3333
{% if security.oauthglue %}
3434
<hr class="fs-gap">
35-
<h2>{{ _fsdomain("Use Social OAuth to Sign In") }}</h2>
35+
<h2>{{ _fsdomain("Use Social Login to Sign In") }}</h2>
3636
{% for provider in security.oauthglue.provider_names %}
3737
<div class="fs-gap">
3838
<form method="post" id="{{ provider }}_form" name="{{ provider }}_form">
39-
<input id="{{ provider }}" name="{{ provider }}" type="submit" value="{{ _fsdomain('Sign in with %(provider)s', provider=provider) }}" formaction="{{ url_for_security('oauthstart', name=provider) }}{{ prop_next() }}">
39+
<input id="{{ provider }}" name="{{ provider }}" type="submit" value="{{ _fsdomain('Continue with %(provider)s', provider=provider) }}" formaction="{{ url_for_security('oauthstart', name=provider) }}{{ prop_next() }}">
4040
{% if csrf_token is defined %}
4141
<input id="{{ provider }}_csrf_token" name="{{ provider }}_csrf_token" type="hidden" value="{{ csrf_token() }}">
4242
{% endif %}

0 commit comments

Comments
 (0)