diff options
| author | ReAnzu <anzu@reanzu.com> | 2018-02-25 04:44:02 -0600 |
|---|---|---|
| committer | rr- <rr-@sakuya.pl> | 2018-03-25 22:23:29 +0200 |
| commit | 2a69f0193f9e5aa451e0dbcb8c89070f3e49ffa5 (patch) | |
| tree | bda640614ae711e8fef0e0463f118f85ef83ac0e /server/szurubooru/func/util.py | |
| parent | e35e70992736340bff3995ca6f425baf2f431e2f (diff) | |
server/auth: add token authentication
* Users are only authenticated against their password on login,
and to retrieve a token
* Passwords are wiped from the GUI frontend and cookies
after login and token retrieval
* Tokens are revoked at the end of the session/logout
* If the user chooses the "remember me" option,
the token is stored in the cookie
* Tokens correctly delete themselves on logout
* Tokens can expire at user-specified date
* Tokens have their last usage time
* Tokens can have user defined descriptions
* Users can manage login tokens in their account settings
Diffstat (limited to 'server/szurubooru/func/util.py')
| -rw-r--r-- | server/szurubooru/func/util.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/server/szurubooru/func/util.py b/server/szurubooru/func/util.py index ba2d4dc..5e82286 100644 --- a/server/szurubooru/func/util.py +++ b/server/szurubooru/func/util.py @@ -160,6 +160,12 @@ def value_exceeds_column_size(value: Optional[str], column: Any) -> bool: return len(value) > max_length +def get_column_size(column: Any) -> Optional[int]: + if not column: + return None + return column.property.columns[0].type.length + + def chunks(source_list: List[Any], part_size: int) -> Generator: for i in range(0, len(source_list), part_size): yield source_list[i:i + part_size] |