rocket_auth icon indicating copy to clipboard operation
rocket_auth copied to clipboard

Maintenance Patch

Open krbundy opened this issue 1 year ago • 0 comments

Update

A little background on the unsolicited update: I wanted to try rocket for a very low stakes project at work, and needed some very basic authentication and wanted to use SQLite to store data. This go me to some issues with package versions with rocket_auth and the rest of the rocket ecosystem/sqlx. I fixed them (it was shorter than doing the auth myself) and thought I would push my updates here. If this is unwelcome in any way please go ahead and simply reject it.

Overview

This PR includes a lot of updates. They fall into three categories. Overall, the main goal was to bring the package up to sync with the new version of rocket (0.5.1 when I started this, at least) and a newer version of rocket_db_pools (this version created an issue with versions of libsqlite-sys). This lead to a few changes:

  1. Updating dependencies to the newest versions,
  2. upating the code to be compatible with this, (validator and rocket updates where breaking changes)
  3. converting some of the #[throws(error)] declarations to have explicit Result<> return types in some places
  4. I added the sqlite database used in the tests to the .gitignore

Package updates

I pushed everything to use the latest version. Every package. This broke some things (validator no longer includes validate_email() (as an exported function at least) so I wrote a custom on, and added a test for it. It's a simple regex trick but is worked for my purpose; I have only two test cases for it so far.

Also, bumping to a later version of rocket was an issue. the rocket::Outcome enum is changed; Outcome::Failure has become Outcome::Error, which I updated throughout.

I mostly had to change the auth.rs, user.rs, and user_impl.rs files, so I went through and updated those functions to have an explicit return type for them. There are some more #[throws(error) macros around the other files that will have to be dealt with at some point.

I also updated the validator derive macro for Signup to use the new custom validator syntax (again, a breaking change there).

None of the udpate

krbundy avatar Nov 11 '24 18:11 krbundy