Skip to content

Commit

Permalink
Added support for changing password (#9)
Browse files Browse the repository at this point in the history
* Fixed: server refuses to respond in any way to the sent iq stanza.
* Fix issue dino#261.
---------
Co-authored-by: Miquel Lionel <[email protected]>
Co-authored-by: Stanislav Malishevskiy <[email protected]>
  • Loading branch information
mxlgv authored Mar 19, 2024
1 parent 825cc58 commit e25d5d4
Show file tree
Hide file tree
Showing 50 changed files with 1,011 additions and 1 deletion.
7 changes: 7 additions & 0 deletions libdino/src/service/registration.vala
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ public class Register : StreamInteractionModule, Object{
return ret;
}

public async string? change_password(Account account, string new_pw){
XmppStream stream = stream_interactor.get_stream(account);
if (stream == null) return "Connection unavailable";
return yield stream.get_module(Xep.InBandRegistration.Module.IDENTITY).change_password(stream, account.full_jid, new_pw);
}

public class ServerAvailabilityReturn {
public bool available { get; set; }
public TlsCertificateFlags? error_flags { get; set; }
Expand Down Expand Up @@ -229,3 +235,4 @@ public class Register : StreamInteractionModule, Object{
}

}

2 changes: 2 additions & 0 deletions main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ set(RESOURCE_LIST
conversation_content_view/view.ui
manage_accounts/account_row.ui
manage_accounts/add_account_dialog.ui
manage_accounts/change_password_dialog.ui
manage_accounts/dialog.ui
menu_add.ui
menu_app.ui
Expand Down Expand Up @@ -218,6 +219,7 @@ SOURCES

src/ui/manage_accounts/account_row.vala
src/ui/manage_accounts/add_account_dialog.vala
src/ui/manage_accounts/change_password_dialog.vala
src/ui/manage_accounts/dialog.vala

src/ui/occupant_menu/list.vala
Expand Down
1 change: 1 addition & 0 deletions main/data/gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<file>manage_accounts/account_row.ui</file>
<file>manage_accounts/add_account_dialog.ui</file>
<file>manage_accounts/dialog.ui</file>
<file>manage_accounts/change_password_dialog.ui</file>
<file>menu_add.ui</file>
<file>menu_app.ui</file>
<file>menu_conversation.ui</file>
Expand Down
158 changes: 158 additions & 0 deletions main/data/manage_accounts/change_password_dialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<template class="DinoUiChangePasswordDialog">
<property name="title" translatable="1">Change password</property>
<property name="valign">center</property>
<property name="modal">True</property>
<child internal-child="content_area">
<object class="GtkBox">
<child>
<object class="GtkGrid" id="info_grid">
<property name="orientation">vertical</property>
<property name="margin-start">20</property>
<property name="margin-end">20</property>
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<property name="row-spacing">7</property>
<property name="column-spacing">10</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="1">Current password</property>
<property name="xalign">1</property>
<layout>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkEntry" id="current_passwd_entry">
<property name="activates_default">1</property>
<property name="hexpand">1</property>
<property name="width_request">200</property>
<property name="visibility">False</property>
<layout>
<property name="column">1</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="1">New password</property>
<property name="xalign">1</property>
<layout>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkEntry" id="new_passwd_entry">
<property name="activates_default">1</property>
<property name="hexpand">1</property>
<property name="width_request">200</property>
<property name="visibility">False</property>
<layout>
<property name="column">1</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="1">Confirm new password</property>
<property name="xalign">1</property>
<layout>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkEntry" id="confirm_new_passwd_entry">
<property name="activates_default">1</property>
<property name="hexpand">1</property>
<property name="width_request">200</property>
<property name="visibility">False</property>
<layout>
<property name="column">1</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="change_password_error_label">
<!-- property name="xalign">0</property -->
<property name="halign">center</property>
<property name="hexpand">True</property>
<property name="margin-top">7</property>
<attributes>
<attribute name="scale" value="0.9"></attribute>
</attributes>
<layout>
<property name="column">0</property>
<property name="row">3</property>
<property name="column-span">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="cancel_button">
<property name="label" translatable="1">Cancel</property>
<layout>
<property name="column">0</property>
<property name="row">4</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="change_password_button">
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="sensitive">0</property>
<layout>
<property name="column">1</property>
<property name="row">4</property>
</layout>
<style>
<class name="text-button"/>
<class name="suggested-action"/>
</style>
<child>
<object class="GtkStack" id="change_password_stack">
<child>
<object class="GtkStackPage">
<property name="name">label</property>
<property name="child">
<object class="GtkLabel" >
<property name="label" translatable="1">Change password</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">spinner</property>
<property name="child">
<object class="GtkSpinner">
<property name="spinning">True</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<action-widgets>
<action-widget response="cancel">cancel_button</action-widget>
<action-widget response="ok" default="true">change_password_button</action-widget>
</action-widgets>
</template>
</interface>
12 changes: 11 additions & 1 deletion main/data/manage_accounts/dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,17 @@
<layout>
<property name="column">1</property>
<property name="row">2</property>
<property name="column-span">2</property>
<property name="column-span">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="password_change_btn">
<property name="label">⚙️</property>
<layout>
<property name="column">2</property>
<property name="row">2</property>
<property name="column-span">1</property>
</layout>
</object>
</child>
Expand Down
1 change: 1 addition & 0 deletions main/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ sources = files(
'src/ui/main_window_controller.vala',
'src/ui/manage_accounts/account_row.vala',
'src/ui/manage_accounts/add_account_dialog.vala',
'src/ui/manage_accounts/change_password_dialog.vala',
'src/ui/manage_accounts/dialog.vala',
'src/ui/notifier_freedesktop.vala',
'src/ui/notifier_gnotifications.vala',
Expand Down
18 changes: 18 additions & 0 deletions main/po/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,24 @@ msgstr "لقد أعددت كل شيء!"
msgid "Finish"
msgstr "أنهي"

#: main/src/ui/manage_accounts/change_password_dialog.vala :5
#: main/src/ui/manage_accounts/change_password_dialog.vala :103
msgid "Change password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :21
msgid "Current password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :43
msgid "New password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :65
msgid "Confirm new password"
msgstr ""


#~ msgid "Click here to start a conversation or join a channel."
#~ msgstr "اضغط هنا لبداية المحادثة أو للإنضمام إلى قناة."

Expand Down
18 changes: 18 additions & 0 deletions main/po/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,24 @@ msgstr "Tot llest!"
msgid "Finish"
msgstr "Finalitza"

#: main/src/ui/manage_accounts/change_password_dialog.vala :5
#: main/src/ui/manage_accounts/change_password_dialog.vala :103
msgid "Change password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :21
msgid "Current password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :43
msgid "New password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :65
msgid "Confirm new password"
msgstr ""


#~ msgid "Click here to start a conversation or join a channel."
#~ msgstr "Feu clic aquí per a començar una conversa o unir-vos a un canal."

Expand Down
17 changes: 17 additions & 0 deletions main/po/cs.po
Original file line number Diff line number Diff line change
Expand Up @@ -1166,5 +1166,22 @@ msgstr "Vše připraveno!"
msgid "Finish"
msgstr "Dokončit"

#: main/src/ui/manage_accounts/change_password_dialog.vala :5
#: main/src/ui/manage_accounts/change_password_dialog.vala :103
msgid "Change password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :21
msgid "Current password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :43
msgid "New password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :65
msgid "Confirm new password"
msgstr ""

#~ msgid "Click here to start a conversation or join a channel."
#~ msgstr "Kliknutím sem zahájíte konverzaci nebo se připojíte ke kanálu."
17 changes: 17 additions & 0 deletions main/po/da.po
Original file line number Diff line number Diff line change
Expand Up @@ -1153,3 +1153,20 @@ msgstr ""
#: main/data/manage_accounts/add_account_dialog.ui:506
msgid "Finish"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :5
#: main/src/ui/manage_accounts/change_password_dialog.vala :103
msgid "Change password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :21
msgid "Current password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :43
msgid "New password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :65
msgid "Confirm new password"
msgstr ""
17 changes: 17 additions & 0 deletions main/po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,23 @@ msgstr "Fertig!"
msgid "Finish"
msgstr "Fertig"

#: main/src/ui/manage_accounts/change_password_dialog.vala :5
#: main/src/ui/manage_accounts/change_password_dialog.vala :103
msgid "Change password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :21
msgid "Current password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :43
msgid "New password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :65
msgid "Confirm new password"
msgstr ""

#~ msgid "Click here to start a conversation or join a channel."
#~ msgstr ""
#~ "Klicke hier, um eine Unterhaltung zu starten oder einem Kanal beizutreten."
Expand Down
17 changes: 17 additions & 0 deletions main/po/dino.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1154,3 +1154,20 @@ msgstr ""
#: main/data/manage_accounts/add_account_dialog.ui:506
msgid "Finish"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :5
#: main/src/ui/manage_accounts/change_password_dialog.vala :103
msgid "Change password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :21
msgid "Current password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :43
msgid "New password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :65
msgid "Confirm new password"
msgstr ""
17 changes: 17 additions & 0 deletions main/po/el.po
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,23 @@ msgstr "Όλα έτοιμα!"
msgid "Finish"
msgstr "Ολοκλήρωση"

#: main/src/ui/manage_accounts/change_password_dialog.vala :5
#: main/src/ui/manage_accounts/change_password_dialog.vala :103
msgid "Change password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :21
msgid "Current password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :43
msgid "New password"
msgstr ""

#: main/src/ui/manage_accounts/change_password_dialog.vala :65
msgid "Confirm new password"
msgstr ""

#~ msgid "Click here to start a conversation or join a channel."
#~ msgstr ""
#~ "Κάντε κλικ εδώ για να ξεκινήσετε μια συνομιλία ή να εισέλθετε σε ένα "
Expand Down
Loading

0 comments on commit e25d5d4

Please sign in to comment.