fix(communities): keycard authentication marked automatically as authenticated

Closes #14174
This commit is contained in:
Sale Djenic 2024-03-27 10:06:14 +01:00 committed by saledjenic
parent 3e76fa6179
commit 9b8401b641
11 changed files with 37 additions and 12 deletions

View File

@ -16,6 +16,9 @@ method load*(self: AccessInterface) {.base.} =
method isLoaded*(self: AccessInterface): bool {.base.} = method isLoaded*(self: AccessInterface): bool {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method cleanJoinEditCommunityData*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method onActivated*(self: AccessInterface) {.base.} = method onActivated*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")

View File

@ -140,7 +140,7 @@ method delete*(self: Module) =
self.controller.delete self.controller.delete
self.communityTokensModule.delete self.communityTokensModule.delete
proc clean(self: Module) = method cleanJoinEditCommunityData*(self: Module) =
self.joiningCommunityDetails.clear() self.joiningCommunityDetails.clear()
method load*(self: Module) = method load*(self: Module) =
@ -351,20 +351,20 @@ method communityMuted*(self: Module, communityId: string, muted: bool) =
self.view.model().setMuted(communityId, muted) self.view.model().setMuted(communityId, muted)
method communityAccessRequested*(self: Module, communityId: string) = method communityAccessRequested*(self: Module, communityId: string) =
self.clean() self.cleanJoinEditCommunityData()
self.view.communityAccessRequested(communityId) self.view.communityAccessRequested(communityId)
method communityAccessFailed*(self: Module, communityId, err: string) = method communityAccessFailed*(self: Module, communityId, err: string) =
error "communities: ", err error "communities: ", err
self.clean() self.cleanJoinEditCommunityData()
self.view.communityAccessFailed(communityId, err) self.view.communityAccessFailed(communityId, err)
method communityEditSharedAddressesSucceeded*(self: Module, communityId: string) = method communityEditSharedAddressesSucceeded*(self: Module, communityId: string) =
self.clean() self.cleanJoinEditCommunityData()
self.view.communityEditSharedAddressesSucceeded(communityId) self.view.communityEditSharedAddressesSucceeded(communityId)
method communityEditSharedAddressesFailed*(self: Module, communityId, error: string) = method communityEditSharedAddressesFailed*(self: Module, communityId, error: string) =
self.clean() self.cleanJoinEditCommunityData()
self.view.communityEditSharedAddressesFailed(communityId, error) self.view.communityEditSharedAddressesFailed(communityId, error)
method communityHistoryArchivesDownloadStarted*(self: Module, communityId: string) = method communityHistoryArchivesDownloadStarted*(self: Module, communityId: string) =
@ -723,7 +723,6 @@ proc anyProfileKeyPairAddressSelectedToBeRevealed(self: Module): bool =
method onUserAuthenticated*(self: Module, pin: string, password: string, keyUid: string) = method onUserAuthenticated*(self: Module, pin: string, password: string, keyUid: string) =
if password == "" and pin == "": if password == "" and pin == "":
info "unsuccesful authentication" info "unsuccesful authentication"
self.clean()
return return
self.joiningCommunityDetails.profilePassword = password self.joiningCommunityDetails.profilePassword = password

View File

@ -124,6 +124,9 @@ QtObject:
proc load*(self: View) = proc load*(self: View) =
self.delegate.viewDidLoad() self.delegate.viewDidLoad()
proc cleanJoinEditCommunityData*(self: View) {.slot.} =
self.delegate.cleanJoinEditCommunityData()
proc communityAdded*(self: View, communityId: string) {.signal.} proc communityAdded*(self: View, communityId: string) {.signal.}
proc communityChanged*(self: View, communityId: string) {.signal.} proc communityChanged*(self: View, communityId: string) {.signal.}
proc discordOldestMessageTimestampChanged*(self: View) {.signal.} proc discordOldestMessageTimestampChanged*(self: View) {.signal.}

View File

@ -135,7 +135,8 @@ Dialog {
} }
onClosed: { onClosed: {
if (root.destroyOnClose) if (root.destroyOnClose) {
root.destroy(); root.destroy();
} }
} }
}

View File

@ -328,7 +328,7 @@ StackLayout {
} }
onClosed: { onClosed: {
destroy() root.rootStore.cleanJoinEditCommunityData()
} }
Connections { Connections {

View File

@ -415,6 +415,10 @@ QtObject {
communitiesModuleInst.joinCommunityOrEditSharedAddresses() communitiesModuleInst.joinCommunityOrEditSharedAddresses()
} }
function cleanJoinEditCommunityData() {
communitiesModuleInst.cleanJoinEditCommunityData()
}
function getLatestBlockNumber(chainId) { function getLatestBlockNumber(chainId) {
return walletSection.getChainIdForSend(chainId) return walletSection.getChainIdForSend(chainId)
} }

View File

@ -586,7 +586,7 @@ Item {
} }
onClosed: { onClosed: {
destroy() root.store.cleanJoinEditCommunityData()
} }
Connections { Connections {

View File

@ -277,7 +277,9 @@ SettingsContentBase {
root.rootStore.updatePermissionsModel(dialogRoot.communityId, sharedAddresses) root.rootStore.updatePermissionsModel(dialogRoot.communityId, sharedAddresses)
} }
onClosed: destroy() onClosed: {
chatStore.cleanJoinEditCommunityData()
}
Connections { Connections {
target: chatStore.communitiesModuleInst target: chatStore.communitiesModuleInst

View File

@ -253,6 +253,10 @@ QtObject {
communitiesModuleInst.joinCommunityOrEditSharedAddresses() communitiesModuleInst.joinCommunityOrEditSharedAddresses()
} }
function cleanJoinEditCommunityData() {
communitiesModuleInst.cleanJoinEditCommunityData()
}
function updatePermissionsModel(communityId, sharedAddresses) { function updatePermissionsModel(communityId, sharedAddresses) {
communitiesModuleInst.checkPermissions(communityId, JSON.stringify(sharedAddresses)) communitiesModuleInst.checkPermissions(communityId, JSON.stringify(sharedAddresses))
} }

View File

@ -735,11 +735,17 @@ QtObject {
dialogRoot.close(); dialogRoot.close();
} }
} }
onSharedAddressesUpdated: { onSharedAddressesUpdated: {
root.rootStore.updatePermissionsModel(dialogRoot.communityId, sharedAddresses) root.rootStore.updatePermissionsModel(dialogRoot.communityId, sharedAddresses)
} }
onAboutToShow: { root.rootStore.communityKeyToImport = dialogRoot.communityId; } onAboutToShow: { root.rootStore.communityKeyToImport = dialogRoot.communityId; }
onClosed: { root.rootStore.communityKeyToImport = ""; destroy(); }
onClosed: {
root.rootStore.communityKeyToImport = "";
root.rootStore.cleanJoinEditCommunityData()
}
Connections { Connections {
target: root.rootStore.communitiesModuleInst target: root.rootStore.communitiesModuleInst
@ -963,7 +969,9 @@ QtObject {
root.rootStore.joinCommunityOrEditSharedAddresses() root.rootStore.joinCommunityOrEditSharedAddresses()
} }
onClosed: destroy() onClosed: {
root.rootStore.cleanJoinEditCommunityData()
}
Connections { Connections {
target: root.rootStore.communitiesModuleInst target: root.rootStore.communitiesModuleInst

View File

@ -18,6 +18,7 @@ import SortFilterProxyModel 0.2
StatusStackModal { StatusStackModal {
id: root id: root
destroyOnClose: true
property bool isEditMode: false property bool isEditMode: false
required property string communityName required property string communityName