Repository navigation
fix: identity & token screen safety and validation #563
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
Changes from 7 commits
869006c
7ca8660
edbcb2a
840f277
b26fa7e
8a3beb0
213b9b0
12dbeb8
111ff0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -934,22 +934,27 @@ impl IdentitiesScreen { | |
| let mut lock = self.identities.lock().unwrap(); | ||
| lock.shift_remove(&identity_id); | ||
|
lklimek marked this conversation as resolved.
Resolved
|
||
|
|
||
| self.app_context | ||
| if let Err(e) = self | ||
| .app_context | ||
| .db | ||
| .delete_local_qualified_identity(&identity_id, &self.app_context) | ||
| .ok(); | ||
| { | ||
| tracing::warn!("Failed to delete identity from database: {}", e); | ||
| } | ||
|
||
|
|
||
| if let Some((voter_identity, _)) = | ||
| &identity_to_remove.associated_voter_identity | ||
| { | ||
| let voter_identity_id = voter_identity.id(); | ||
| self.app_context | ||
| .db | ||
| .delete_local_qualified_identity( | ||
| &voter_identity_id, | ||
| &self.app_context, | ||
| ) | ||
| .ok(); | ||
| if let Err(e) = self.app_context.db.delete_local_qualified_identity( | ||
| &voter_identity_id, | ||
| &self.app_context, | ||
| ) { | ||
| tracing::warn!( | ||
| "Failed to delete voter identity from database: {}", | ||
| e | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| self.identity_to_remove = None; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -501,14 +501,18 @@ impl ScreenLike for TransferScreen { | |
|
|
||
| fn refresh(&mut self) { | ||
| // Refresh the identity because there might be new keys | ||
| self.identity = self | ||
| let identities = self | ||
| .app_context | ||
| .load_local_qualified_identities() | ||
| .unwrap() | ||
| .into_iter() | ||
| .unwrap_or_default(); | ||
|
||
| if let Some(refreshed) = identities | ||
| .iter() | ||
| .find(|identity| identity.identity.id() == self.identity.identity.id()) | ||
| .unwrap(); | ||
| self.max_amount = self.identity.identity.balance(); | ||
| { | ||
| self.identity = refreshed.clone(); | ||
| self.max_amount = self.identity.identity.balance(); | ||
| } | ||
| self.known_identities = identities; | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| } | ||
|
|
||
| /// Renders the UI components for the withdrawal screen | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -319,14 +319,16 @@ impl ScreenLike for WithdrawalScreen { | |
|
|
||
| fn refresh(&mut self) { | ||
| // Refresh the identity because there might be new keys | ||
| self.identity = self | ||
| if let Some(refreshed) = self | ||
| .app_context | ||
| .load_local_qualified_identities() | ||
| .unwrap() | ||
| .unwrap_or_default() | ||
| .into_iter() | ||
|
Comment on lines
+322
to
326
|
||
| .find(|identity| identity.identity.id() == self.identity.identity.id()) | ||
| .unwrap(); | ||
| self.max_amount = self.identity.identity.balance(); | ||
| { | ||
| self.identity = refreshed; | ||
| self.max_amount = self.identity.identity.balance(); | ||
| } | ||
| } | ||
|
|
||
| /// Renders the UI components for the withdrawal screen | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -203,6 +203,13 @@ impl ClaimTokensScreen { | |||||
| match dialog.show(ui).inner.dialog_response { | ||||||
| Some(ConfirmationStatus::Confirmed) => { | ||||||
| self.confirmation_dialog = None; | ||||||
|
|
||||||
| if self.selected_key.is_none() { | ||||||
| self.error_message = Some("No signing key selected".into()); | ||||||
| self.status = ClaimTokensStatus::ErrorMessage("No key selected".into()); | ||||||
|
||||||
| self.status = ClaimTokensStatus::ErrorMessage("No key selected".into()); | |
| self.status = ClaimTokensStatus::ErrorMessage("No signing key selected".into()); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -260,6 +260,12 @@ impl DestroyFrozenFundsScreen { | |||||
| } | ||||||
|
|
||||||
| fn confirmation_ok(&mut self) -> AppAction { | ||||||
| if self.selected_key.is_none() { | ||||||
| self.error_message = Some("No signing key selected".into()); | ||||||
| self.status = DestroyFrozenFundsStatus::ErrorMessage("No key selected".into()); | ||||||
|
||||||
| self.status = DestroyFrozenFundsStatus::ErrorMessage("No key selected".into()); | |
| self.status = DestroyFrozenFundsStatus::ErrorMessage("No signing key selected".into()); |
Uh oh!
There was an error while loading. Please reload this page.