From f8c004630f56914438fa1b114530f639748e41c1 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Mon, 16 Sep 2024 22:47:49 +0200 Subject: Add change password functionality Co-authored-by: Stanislav Malishevskiy --- main/src/view_model/preferences_window.vala | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'main/src/view_model/preferences_window.vala') 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; + } +} + -- cgit v1.2.3-70-g09d2