diff options
author | fiaxh <git@lightrise.org> | 2024-09-16 22:47:49 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2024-09-21 17:06:20 +0100 |
commit | f8c004630f56914438fa1b114530f639748e41c1 (patch) | |
tree | 4a9d2ae1de436c00e9d1ac75e05426291be52c4b /main/src/view_model | |
parent | b09556f03349b51d95c14d1046add355a4754e01 (diff) | |
download | dino-f8c004630f56914438fa1b114530f639748e41c1.tar.gz dino-f8c004630f56914438fa1b114530f639748e41c1.zip |
Add change password functionality
Co-authored-by: Stanislav Malishevskiy <stanislav.malishevskiy@gmail.com>
Diffstat (limited to 'main/src/view_model')
-rw-r--r-- | main/src/view_model/preferences_window.vala | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/main/src/view_model/preferences_window.vala b/main/src/view_model/preferences_window.vala index 9cc5a80e..7d967605 100644 --- a/main/src/view_model/preferences_window.vala +++ b/main/src/view_model/preferences_window.vala @@ -98,6 +98,13 @@ public class Dino.Ui.ViewModel.PreferencesWindow : Object { update_data(); } + public ChangePasswordDialog get_change_password_dialog_model() { + return new ChangePasswordDialog() { + account = selected_account.account, + stream_interactor = stream_interactor + }; + } + private void bind_general_page() { var settings = Dino.Application.get_default().settings; settings.bind_property("send-typing", general_page, "send-typing", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); @@ -107,3 +114,16 @@ public class Dino.Ui.ViewModel.PreferencesWindow : Object { } } +public class Dino.Ui.ViewModel.ChangePasswordDialog : Object { + public Entities.Account account { get; set; } + public StreamInteractor stream_interactor { get; set; } + + public async string? change_password(string new_password) { + var res = yield stream_interactor.get_module(Register.IDENTITY).change_password(account, new_password); + if (res == null) { + account.password = new_password; + } + return res; + } +} + |