Skip to content
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

Trait FromRequest not implemented for User/Admin when trying to use guards #34

Closed
SpootDev opened this issue Apr 13, 2022 · 1 comment
Closed

Comments

@SpootDev
Copy link

rust 1.60 stable
rocket_auth = { version = "0.4.0", features = ["sqlx-postgres"] }
rocket = { git = "https://github.com/SergioBenitez/Rocket/", features = ["json", "secrets", "uuid"]}
rocket_dyn_templates = { git = "https://github.com/SergioBenitez/Rocket/", features = ["tera"]}

I see the traits in the rocket_auth lib.......so, obviously, I'm doing something silly. Looking for input on what I'm doing wrong.

use rocket_auth::{Users, Error, Auth, Signup, Login, User, AdminUser};

#[get("/admin-panel")]
fn admin_panel(user: AdminUser) -> String {
format!("Hello {}.", user.email())
}

error[E0277]: the trait bound rocket_auth::AdminUser: FromRequest<'_> is not satisfied
--> src/admin/bp_user.rs:27:22
|
27 | fn admin_panel(user: AdminUser) -> String {
| ^^^^^^^^^ the trait FromRequest<'_> is not implemented for rocket_auth::AdminUser

@SpootDev
Copy link
Author

Specifying the rc1 cleared this up.
rocket = { version = "0.5.0-rc.1", features = ["json", "secrets", "uuid"]}
rocket_dyn_templates = { version = "0.1.0-rc.1", features = ["tera"]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant