mirror of
https://github.com/danbulant/Portfolio
synced 2026-07-05 19:11:06 +00:00
refactor: code cleanup
This commit is contained in:
parent
a2d1447c2d
commit
5d52cf7772
1 changed files with 4 additions and 2 deletions
|
|
@ -21,8 +21,10 @@ impl<'r> FromRequest<'r> for TokenRequest {
|
||||||
let auth_string = auth.to_string();
|
let auth_string = auth.to_string();
|
||||||
if auth_string.starts_with("Bearer") {
|
if auth_string.starts_with("Bearer") {
|
||||||
let token = auth_string[6..auth_string.len()].trim();
|
let token = auth_string[6..auth_string.len()].trim();
|
||||||
if let Ok(token_data) = decode_candidate_token(token.to_string()) {
|
let token_data = decode_candidate_token(token.to_string());
|
||||||
return Outcome::Success(TokenRequest(token_data.claims));
|
|
||||||
|
if token_data.is_ok() {
|
||||||
|
return Outcome::Success(TokenRequest(token_data.ok().unwrap().claims));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue