Commit Graph

38 Commits

Author SHA1 Message Date
rr- c9cb9aa539 server/password-reset: try to construct full URL 2018-07-08 10:10:06 +02:00
ReAnzu 2a69f0193f 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
2018-03-25 22:23:29 +02:00
ReAnzu 3f52aceca4 server/users: harden password hashes
- Changed password setup to use libsodium and argon2id (regular SHA256
  hashing for passwords is inadequate as modern GPU's can hash generate
  billions of hashes per second).
- Added code to auto migrate old passwords to the new password_hash if
  the existing password_hash matches either of the legacy password
  generation schemes (SHA1 or SHA256).
- Added migration to support new password_hash format length
- Added column password_revision. This field will default to 0, which
  all passwords will have till they're updated. After that each password
  hash method has a revision.
2018-03-08 23:40:47 +01:00
rr- ad842ee8a5 server: refactor + add type hinting
- Added type hinting (for now, 3.5-compatible)
- Split `db` namespace into `db` module and `model` namespace
- Changed elastic search to be created lazily for each operation
- Changed to class based approach in entity serialization to allow
  stronger typing
- Removed `required` argument from `context.get_*` family of functions;
  now it's implied if `default` argument is omitted
- Changed `unalias_dict` implementation to use less magic inputs
2017-02-05 16:34:45 +01:00
rr- 894cd29511 server/tests: test image hash 2017-02-03 19:53:10 +01:00
rr- 1a59a74d63 server/image-hash: add image search engine 2016-12-26 15:00:16 +01:00
rr- 995cd4610d server: drop old style class declarations 2016-10-22 14:43:52 +02:00
rr- 9d6a0e0173 server/posts: add post merging 2016-10-21 21:48:38 +02:00
rr- 243ab15b85 server/tags: add order to tag names
The better implementation of a224297.

Fixes ability to reorder tag aliases, especially - the ability to change
the tag's primary name after it was created. Until now, both of these
scenarios needed sad workarounds on the user part.
2016-08-28 20:00:50 +02:00
rr- bb369efa99 server/general: disable autoflush 2016-08-26 14:41:05 +02:00
rr- 6c29377f6b server/db: allow full DSN; use memdb in tests
The earlier commit is still relevant as it allows to integrate real
database when needed.
2016-08-16 21:42:09 +02:00
rr- 87b1ee4564 server/tests: use real database
I'm experimenting with snapshots and found following limitation of
SQLite: https://www.sqlite.org/isolation.html
2016-08-16 17:22:33 +02:00
rr- 9aea55e3d1 server/general: embrace most of PEP8
Ignored only the rules about continuing / hanging indentation.

Also, added __init__.py to tests so that pylint discovers them. (I don't
buy pytest's BS about installing your package.)
2016-08-14 16:44:03 +02:00
rr- af62f8c45a server/general: ditch falcon for in-house WSGI app
For quite some time, I hated Falcon's class maps approach that caused
more chaos than good for Szurubooru. I've taken a look at the other
frameworks (hug, flask, etc) again, but they all looked too
bloated/over-engineered. I decided to just talk to WSGI myself.

Regex-based routing may not be the fastest in the world, but I'm fine
with response time of 10 ms for cached /posts.
2016-08-14 16:43:35 +02:00
rr- 2b3d193b7c server/tags: don't auto-create tag categories 2016-08-14 11:38:59 +02:00
rr- 205f372f76 server/tests: colorize verbose output 2016-05-11 23:47:50 +02:00
rr- 198cb0af3e server/users: hardcode available ranks 2016-05-08 16:59:25 +02:00
rr- ce095816d9 server/posts: add post creating 2016-05-02 00:07:33 +02:00
rr- 4530b6e3b8 server/tests: show SQL queries only with -v 2016-04-30 12:46:52 +02:00
rr- 612734e9ff server/comments: add comment creating 2016-04-24 10:31:49 +02:00
rr- 093863b944 server/comments: add comment tables 2016-04-24 10:31:49 +02:00
rr- cf00a3a2de server/posts: add post featuring 2016-04-22 20:58:04 +02:00
rr- a926838b90 server/general: rename 'misc' to 'util' 2016-04-20 11:59:46 +02:00
rr- 57b18c6461 server/general: rename 'util' to 'func' 2016-04-20 11:58:17 +02:00
rr- d3f2ef296b server/tests: don't recreate database every test 2016-04-20 11:48:34 +02:00
rr- 2e57a0746f server/general: consistently use db.session 2016-04-19 18:10:22 +02:00
rr- fe56e376f6 server/tags: export also tag categories 2016-04-19 15:51:26 +02:00
rr- 2fba374e65 server/tags: introduce tag category API 2016-04-19 12:05:14 +02:00
rr- 1597ae7c5c server/db: refactor session usage 2016-04-18 23:06:51 +02:00
rr- e3a4793d54 server/tags: move tag categories to database 2016-04-18 22:08:30 +02:00
rr- 1c064778c6 server/tests: adapt freezegun
The reason why this is added to the project is because it has turned out
mocking the time is not as trivial as I originally anticipated
(specifically, there are some problems with SQLite).
2016-04-18 19:42:24 +02:00
rr- bc15fb6675 server/posts: add sketch of post table 2016-04-17 16:35:31 +02:00
rr- 470ff70f91 server/tests: use common fixtures in pw reset test 2016-04-17 12:54:30 +02:00
rr- adecdd4cd9 server/tags: add tag updating 2016-04-16 13:41:19 +02:00
rr- ec4cba94a9 server/db: introduce tags 2016-04-16 09:19:55 +02:00
rr- 3bf9d6b462 server/tests: add sql logging 2016-04-15 23:26:38 +02:00
rr- 3d4ceb13b8 server/api: move all io mgmt to context
where input/output includes files, JSON metadata and GET parameters.
Additionally, formalize context with a new class, Context.
2016-04-15 23:26:38 +02:00
rr- 07ea920def server/tests: switch to pytest 2016-04-15 18:00:06 +02:00