Comments (3)
Thanks for bringing this to my attention. This is definitely not intended. I don't think that modifying the Display
impl of Error
will be sufficient to fix this. Since the validator::ValidationErrors
is still accessible from the error and it holds the password.
I don't know what the best aproach to fix this may be, but I will attempt this problem on the weekend.
from rocket_auth.
I created an issue in the 'validator' repository, but no one answered. Using the ValidatorError directly (not via the derive) it is not possible to set the error message. You can only set the code via the ValidatorError::new(...).
I fixed "this" in my project by dirty matching the error type:
`
#[derive(Error, Debug)]
pub enum ResponseError {
...
//all error types
#[error("{0}")]
RocketAuthError(#[from] rocket_auth::Error),
...
}
impl ResponseError {
pub fn message(&self) -> String {
match self {
ResponseError::RocketAuthError(e) => {
match e {
Error::FormValidationError(validation_error) => {
format!("{}", validation_error.code)
}
Error::FormValidationErrors(validation_errors) => {
let mut buffer = String::new();
let f = validation_errors
.field_errors()
.values()
.map(|x| {
x.iter().map(|y| {
y.code.to_string()
}).collect::()
}).collect();
f
}
... //match rest
}
}
}
`
This is completly stupid, but it does the job. Maybe it can help you
from rocket_auth.
I think we'd have to consider to remove the dependency on validator
and refactor Error
, though that would be a masive breaking change.
from rocket_auth.
Related Issues (20)
- User FromRequest not found with git rocket and TLS HOT 7
- Customizable SQL Schema HOT 3
- Library breaks with rocket 0.5.0-rc.2 HOT 1
- Check if String is same as hashed password HOT 3
- Compile error HOT 1
- Allow option to use username instead of email HOT 5
- Update sqlx to v0.6 HOT 3
- Can AdminUser guard return a 403 instead of a 401? HOT 2
- Use "AUTOINCREMENT" for user table primary key
- Compilation failing due to SQLX features HOT 2
- How to get the value chosen in an html form select, and having that value in a rust variable
- Feat: Redis Stack as a Persistant Data Storage.
- Default Argon2 config does not meet OWASP minimum security HOT 1
- New release with Users table update fix?
- Session is not invalidated after time expires using login_for HOT 1
- add `cargo test` to workflow
- Database error during password change (tokio_postgres)
- Users seems to be able to connect only on one device at the same time
- Does not compile with rocket 0.5.0 (not Rc3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rocket_auth.