Skip to content

Commit

Permalink
Small docs changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
lingthio committed Sep 4, 2017
1 parent 1be1eb6 commit a8d592f
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 43 deletions.
15 changes: 10 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ Well documented

Fully customizable, yet Ready to use
------------------------------------
* **Largely configurable** -- Through configuration settings
* **Almost fully customizable** -- Through customizable functions and email templates
* **Ready to use** -- Through sensible defaults
* Supports **SQL Databases** and **MongoDB Databases**
* **Event hooking** -- Through signals
* **Ready to use** -- Through sensible defaults.
* **Largely configurable** -- By overriding configuration settings.
* **Almost fully customizable** -- By overriding default methods and properties.
* Supports **SQL Databases** and **MongoDB Databases**.
* **Event hooking** -- Through efficient signals.

Comes with translations
-----------------------
Expand Down Expand Up @@ -72,3 +72,8 @@ Alternatives
------------
* `Flask-Login <https://flask-login.readthedocs.org/en/latest/>`_
* `Flask-Security <https://pythonhosted.org/Flask-Security/>`_

Authors
-------
* Ling Thio - ling AT gmail DOT com
* `Many contributors from coders/translators <https://github.com/lingthio/Flask-User/graphs/contributors>`_
8 changes: 4 additions & 4 deletions docs/source/configure_settings.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _ConfigureSettings:
.. _ConfiguringSettings:

Configure settings
==================
Configuring settings
====================

Flask-User default features and settings can overridden in one of two ways:

Expand Down Expand Up @@ -30,7 +30,7 @@ Flask-User default features and settings can overridden in one of two ways:
Flask-User settings
-------------------

Below is a complete list of configurable Flask-User settings.
Below is a complete list of configurable Flask-User settings and their defaults.

Note: Ignore the `__Settings` part of the class name.
It's a trick we use to split the code and docs across several files.
Expand Down
7 changes: 2 additions & 5 deletions docs/source/customization.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
Flask-User Customization
========================

Flask-User is designed to be **largely configurable**,

- :ref:`ConfigureSettings`

and **almost fully customizable**.
Flask-User is designed to be **largely configurable** and **almost fully customizable**.

- :ref:`ConfiguringSettings`
- :ref:`CustomizingForms`
- :ref:`CustomizingValidators`
- :ref:`CustomizingDbAdapter`
Expand Down
39 changes: 16 additions & 23 deletions docs/source/customizing_forms.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _CustomizingForms:

Customizing forms
Customizing Forms
=================

The following Flask-User forms can be customized:
Expand Down Expand Up @@ -66,25 +66,7 @@ You should now have an app/template/flask_user directory::
# email_templates
# ... etc.

4) Optionally change Flask-User's layout template

- Forms that any user may access extend ``app/template/flask_user/_public_base.html``.
- Forms for authorized users may access extend ``app/template/flask_user/_authorized_base.html``.
- Both base templates extend ``app/template/flask_user/_common_base.html``.
- The ``_common_base.html`` finally extends ``app/template/flask_user_layout.html``.

It is likely that you want to use your own ``app/template/layout.html`` template,
and this base file hierarchy is put in place so that you only need to edit one file::

edit app/template/flask_user/_common_base.html

replace:
{% extends "flask_user_layout.html" %}

with:
{% extends "layout.html" %}

Steps 1) through 4) only need to be performed once.
Steps 1) through 3) only need to be performed once.

--------

Expand All @@ -99,6 +81,17 @@ After you've copied the templates, you can edit any HTML template file
in your ``app/template/flask_user/`` directory,
and change it to your liking.

All Flask-User templates extend from ``app/template/flask_user_layout.html``.
You can configure all Flask-User templates to extend from your own template by::

editing app/template/flask_user/_common_base.html, and

replacing:
{% extends "flask_user_layout.html" %}

with:
{% extends "layout.html" %}

--------

.. _CustomizingForms2:
Expand All @@ -108,7 +101,7 @@ Customizing Forms

Optionally, if you need to add form fields to a Flask-User form, you will need to customize that form like so::

# Make sure to add a field to your User class
# Customize the User class
class User(db.Model, UserMixin):
...
country = db.Column(db.String(100), nullable=False)
Expand Down Expand Up @@ -190,8 +183,8 @@ Optionally, if you want to change the default behaviour, you can customize the v

.. _CustomizingValidators:

Customize form field validators
-------------------------------
Customizing Form field Validators
---------------------------------

Flask user ships with default username and password form field validators that can be customized like so::

Expand Down
10 changes: 5 additions & 5 deletions flask_user/user_manager_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ class UserManager__Settings(object):
USER_AUTO_LOGIN_AT_LOGIN = True

#: | Send notification email after a password change.
#: | Requires USER_ENABLE_EMAIL=True.
#: | Depends on USER_ENABLE_EMAIL=True.
USER_SEND_PASSWORD_CHANGED_EMAIL = True

#: | Send notification email after a registration.
#: | Requires USER_ENABLE_EMAIL=True.
#: | Depends on USER_ENABLE_EMAIL=True.
USER_SEND_REGISTERED_EMAIL = True

#: | Send notification email after a username change.
#: | Requires USER_ENABLE_EMAIL=True.
#: | Depends on USER_ENABLE_EMAIL=True.
USER_SEND_USERNAME_CHANGED_EMAIL = True

#: Password hash scheme.
Expand Down Expand Up @@ -163,9 +163,9 @@ class UserManager__Settings(object):
USER_AFTER_LOGIN_ENDPOINT = '' #:
USER_AFTER_LOGOUT_ENDPOINT = '' #:
USER_AFTER_REGISTER_ENDPOINT = '' #:
USER_AFTER_resend_email_confirmation_ENDPOINT = '' #:
USER_AFTER_RESEND_EMAIL_CONFIRMATION_ENDPOINT = '' #:
USER_AFTER_RESET_PASSWORD_ENDPOINT = '' #:
USER_AFTER_INVITE_ENDPOINT = '' #:
USER_UNCONFIRMED_EMAIL_ENDPOINT = '' #:
USER_UNAUTHENTICATED_ENDPOINT = 'user.login' #:
USER_UNAUTHORIZED_ENDPOINT = '' #:
USER_UNCONFIRMED_EMAIL_ENDPOINT = '' #:
2 changes: 1 addition & 1 deletion flask_user/user_manager_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ def resend_email_confirmation_view(self):
_send_confirm_email(user, user_email)

# Redirect to the login page
return redirect(_endpoint_url(um.USER_AFTER_resend_email_confirmation_ENDPOINT))
return redirect(_endpoint_url(um.USER_AFTER_RESEND_EMAIL_CONFIRMATION_ENDPOINT))

# Process GET or invalid POST
return render_template(um.USER_RESENT_CONFIRM_EMAIL_TEMPLATE, form=form)
Expand Down

0 comments on commit a8d592f

Please sign in to comment.