diff options
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; + } +} + |