-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ported user routes to axum #50
Conversation
Also I believe handles should use PrivateCookieJar, but it needs a key. afair rocket by itself manages cookie signing/encryption key, but axum requires key to be declared manually, so my question is how should user set it? Perhaps just an environment variable should be fine? EDIT: I just realized there are settings, so maybe it's a better place for a key? |
With rocket, a random key is generated on every startup for Kellnr. To keep it easy, we can take the same approach for axum. If Kellnr is restarted, the users need to login again, but that is perfectly fine as the session expires anyways. There is the |
Alright then, I'll implement it so the key is generated at startup and stored in the |
@jplatte Do you have any pointers on how to do testing? I don't have experience with writing tests for web apps. |
Does this help? |
Yes, thanks |
@secana I'm trying to port tests at the moment and I'm a bit confused about this test, does it ensure that admin cannot access pages meant for normal users? If so shouldn't admin be able access anything? The test expects not found code and It's just strange to me. EDIT: Similar question to the test |
There are three types of users in Kellnr.
There are pages that are only accessible to either one of them. For example the normal user sees a different settings page than the admin user. Some pages are the same for normal and admin users. That's where the "any user" is used. The The I hope that helps. |
I see, thanks, that helps. |
4e0ed35
to
1093085
Compare
Alright, I believe I ported most tests and all routes under |
I'm on a business trip for the next few days. I'll review and merge when I'm back. So far: thank you for the incredible work. |
I ported
/user
handles to axum without breaking frontend code. There is some room for improvements though, mainly1. Handles should returnResult<_, E>
whereE
is anIntoResponse
type which logs important server errors, makes it easier to debug.2. Didn't port any tests yetSo for now I'll leave this pr as draft