| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
ogCP now have to types of users, regular and administrator users.
ogCP configuration file defines users roles with the boolean field
"ADMIN".
|
|
|
|
|
|
|
|
|
|
|
| |
The front-end now hashes passwords before sending them to the back-end.
It uses SHA-512.
This commit adds a hidden input which sends the password hash to not
interfere with browsers' save password functionality.
Also change passwords of the template configuration file for their
hashed/digested versions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commits configures and sets up flask-babel and adds Spanish po
file. Flask-babel is already a dependency so this commits no needs to
add it.
Users can edit ogcp.json to choose between English or Spanish. After
changing the language in the configuration file, users must restart ogcp
service.
Instructions to generate translation files, inspired by
https://flask-babel.tkte.ch/:
1. Download ogcp source code.
git clone git://git.soleta.eu/ogCP /path/to/ogcp
2. Create a python virtual environment.
python3 -m venv /path/to/new/venv
3. Activate the virtual environment.
source /path/to/new/venv/bin/activate
4. Install dependencies to the virtual environment.
cd /path/to/ogcp
pip3 install -r requirements.txt
5. Extract ogcp strings.
cd /path/to/ogcp/ogcp
pybabel extract -F babel.cfg -k _l -o messages.pot .
NOTE: "-k _l" is needed to extract strings which use lazy
translations.
6. Create or update translation files.
a. Create translation file. This example creates a french translation
file.
pybabel init -i messages.pot -d translations -l fr
b. Update translation files. You need to do this when ogcp strings
change and want to update current supported languages.
pybabel update -i messages.pot -d translations
7. Edit the translations .po file as needed. Example route:
/path/to/ogcp/ogcp/translations/fr/LC_MESSAGES/messages.po.
8. Compile translations.
pybabel compile -d translations
9. Launch ogcp and check the translations.
cd /path/to/ogcp
pip3 install -r requirements.txt
10. Commit and push .po files with translation changes.
|
|
|
|
|
|
|
| |
ogCP limits which scopes can use each user.
Configuration file stores allowed scopes by their names. Leave scope
list empty to give a user permissions on all scopes.
|
|
|
|
|
| |
It is inspired by the following example:
https://github.com/maxcountryman/flask-login/blob/c760c0ef7ccc95d49b4693200245a4f2b148d41b/README.md#usage
|
|
|
|
|
| |
ogcp fails to parse configuration file template because it misses a
comma.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ogcp requires a simple login page in order to avoid exposure of the
ogServer API to anyone trying to access the web page.
Because the main authorization mechanism in ogServer is the api token
the login implemented for the ogcp does not include registration process
but a single user and password specified in the ogcp.json.
"USER": "user",
"PASS": "pass"
Adds two new views: /login and /logout. They are used to login the user so
that the rest of views regarding ogServer functionality can be accessed
in a "login required" fashion. Index view (/) is an exception, it can be
accessed logged in or not so different data can be displayed.
Templates can now access a variable "current_user" to get information
about login status. This is a Flask-Login feature.
- Templates regarding login can be found in templates/auth/
- Login form is defined in forms/auth.py to separate it from
action_forms.py
- Adds Flask-Login module to requirements.txt
- Adds default user and pass in ogcp.json
|
|
|
|
| |
Do not use the same name as ogserver config file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch introduces the usage of Flask.Config class so the config can
be read at startup (__init__) only once. Config keys must be uppercase
so that from_json method does take it into account.
dormousehole.readthedocs.io/en/stable/api.html#flask.Config.from_json
Prior to this patch each request required opening and closing the
ogserver.json file via load_config in views.py.
In the future the decorated load_config function inside views.py
may be removed to avoid creating multiple instances of the OGServer
class.
|
|
This adds views functions and ogServer config loading.
|