[Fix] Use sender ID for change_user_data
This commit is contained in:
parent
defb4c0426
commit
9dc50fdfe0
1 changed files with 58 additions and 64 deletions
|
|
@ -92,6 +92,9 @@ impl OmikronConnection {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ──────────────────────────────
|
||||||
|
// Identification
|
||||||
|
// ──────────────────────────────
|
||||||
if !self.is_identified().await {
|
if !self.is_identified().await {
|
||||||
let identified = *self.identified.read().await;
|
let identified = *self.identified.read().await;
|
||||||
let challenged = *self.challenged.read().await;
|
let challenged = *self.challenged.read().await;
|
||||||
|
|
@ -165,9 +168,6 @@ impl OmikronConnection {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ──────────────────────────────
|
|
||||||
// Challenge response
|
|
||||||
// ──────────────────────────────
|
|
||||||
if identified && !challenged && cv.is_type(CommunicationType::challenge_response) {
|
if identified && !challenged && cv.is_type(CommunicationType::challenge_response) {
|
||||||
let client_response = cv
|
let client_response = cv
|
||||||
.get_data(DataTypes::challenge)
|
.get_data(DataTypes::challenge)
|
||||||
|
|
@ -726,7 +726,7 @@ impl OmikronConnection {
|
||||||
|
|
||||||
// CHANGING DATA
|
// CHANGING DATA
|
||||||
if cv.is_type(CommunicationType::change_user_data) {
|
if cv.is_type(CommunicationType::change_user_data) {
|
||||||
if let Some(user_id) = cv.get_data(DataTypes::user_id).and_then(|v| v.as_i64()) {
|
let user_id = cv.get_sender();
|
||||||
let mut success = true;
|
let mut success = true;
|
||||||
let mut error_message = String::new();
|
let mut error_message = String::new();
|
||||||
|
|
||||||
|
|
@ -760,9 +760,7 @@ impl OmikronConnection {
|
||||||
error_message = e.to_string();
|
error_message = e.to_string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(public_key) =
|
if let Some(public_key) = cv.get_data(DataTypes::public_key).and_then(|v| v.as_str()) {
|
||||||
cv.get_data(DataTypes::public_key).and_then(|v| v.as_str())
|
|
||||||
{
|
|
||||||
if let Some(private_key_hash) = cv
|
if let Some(private_key_hash) = cv
|
||||||
.get_data(DataTypes::private_key_hash)
|
.get_data(DataTypes::private_key_hash)
|
||||||
.and_then(|v| v.as_str())
|
.and_then(|v| v.as_str())
|
||||||
|
|
@ -796,10 +794,6 @@ impl OmikronConnection {
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
self.send_error_response(&cv.get_id(), CommunicationType::error_invalid_data)
|
|
||||||
.await;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if cv.is_type(CommunicationType::change_iota_data) {
|
if cv.is_type(CommunicationType::change_iota_data) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue