This commit is contained in:
@@ -99,11 +99,13 @@ pub async fn post_test_login(
|
||||
if auth_header_str.starts_with("Bearer ") {
|
||||
let token = auth_header_str.trim_start_matches("Bearer ").to_string();
|
||||
// @todo change secret
|
||||
if let Ok(_) = decode::<Claims>(
|
||||
if decode::<Claims>(
|
||||
&token,
|
||||
&DecodingKey::from_secret("secret".as_ref()),
|
||||
&Validation::default(),
|
||||
) {
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
return Ok(Json("Logged in".to_owned()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ pub async fn post_register_user(
|
||||
username: Set(username),
|
||||
password_hash_and_salt: Set(phc_string),
|
||||
nickname: Set({
|
||||
if register_info.nickname == "" {
|
||||
if register_info.nickname.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(register_info.nickname)
|
||||
@@ -61,7 +61,7 @@ pub async fn post_register_user(
|
||||
last_active_time: Set(Utc::now().naive_utc()),
|
||||
is_admin: Set(false),
|
||||
email: Set({
|
||||
if register_info.email == "" {
|
||||
if register_info.email.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(register_info.email)
|
||||
@@ -82,5 +82,5 @@ pub async fn post_register_user(
|
||||
}
|
||||
};
|
||||
|
||||
return (StatusCode::OK, Json(GenericResponse::ok()));
|
||||
(StatusCode::OK, Json(GenericResponse::ok()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user