we can now change our jabber password

This commit is contained in:
Yann Leboulanger 2005-03-04 13:10:00 +00:00
parent 4dd1116ffa
commit cf41cb93f4
4 changed files with 257 additions and 3 deletions

View File

@ -924,6 +924,16 @@ class GajimCore:
self.hub.sendPlugin('GPG_SECRETE_KEYS', ev[1], keys)
elif ev[0] == 'PASSPHRASE':
self.passwords[ev[1]] = ev[2]
#('CHANGE_PASSWORD', account, (new_password, username))
elif ev[0] == 'CHANGE_PASSWORD':
hostname = self.cfgParser.tab[ev[1]]['hostname']
iq = common.jabber.Iq(type='set', to=hostname)
q = iq.setQuery(common.jabber.NS_REGISTER)
q.insertTag('username').insertData(ev[2][1])
q.insertTag('password').insertData(ev[2][0])
id = con.getAnID()
iq.setID(id)
con.send(iq)
else:
log.debug(_("Unknown Command %s") % ev[0])
if self.mode == 'server':

View File

@ -751,9 +751,6 @@ class account_window:
"""When Close button is clicked"""
widget.get_toplevel().destroy()
def destroy(self):
self.window.destroy()
def init_account(self, infos):
"""Initialize window with defaults values"""
if infos.has_key('accname'):
@ -940,6 +937,15 @@ class account_window:
self.plugin.roster.draw_roster()
widget.get_toplevel().destroy()
def on_change_password_button_clicked(self, widget):
dialog = Change_password_dialog(self.plugin, self.account)
new_password = dialog.run()
if new_password != -1:
self.plugin.send('CHANGE_PASSWORD', self.account,\
(new_password, self.plugin.nicks[self.account]))
if self.xml.get_widget('save_password_checkbutton').get_active():
self.xml.get_widget('password_entry').set_text(new_password)
def account_is_ok(self, acct):
"""When the account has been created with sucess"""
self.xml.get_widget('new_account_checkbutton').set_active(False)

View File

@ -628,3 +628,37 @@ class New_message_window:
self.jid_entry.set_activates_default(True)
self.xml.signal_autoconnect(self)
self.plugin.windows['new_message'] = self # now add us to open windows
class Change_password_dialog:
def run(self):
"""Wait for Ok button to be pressed and return away messsage"""
end = False
while not end:
rep = self.dialog.run()
if rep == gtk.RESPONSE_OK:
password1 = self.password1_entry.get_text()
if not password1:
warning_dialog(_('Your password cannot be empty'))
continue
password2 = self.password2_entry.get_text()
if password1 != password2:
warning_dialog(_('Your passwords are not the same'))
continue
message = password1
else:
message = -1
end = True
self.dialog.destroy()
return message
def __init__(self, plugin, account):
if not plugin.connected[account]:
warning_dialog(_('You must be connected to change your password'))
return
self.plugin = plugin
self.account = account
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'change_password_dialog', APP)
self.dialog = self.xml.get_widget('change_password_dialog')
self.password1_entry = self.xml.get_widget('password1_entry')
self.password2_entry = self.xml.get_widget('password2_entry')
self.password1_entry.set_activates_default(True)

View File

@ -945,6 +945,23 @@ Nikos Kouremenos (nkour@jabber.org)</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="change_password_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Change password</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_change_password_button_clicked" last_modification_time="Fri, 04 Mar 2005 11:33:37 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
@ -8656,4 +8673,191 @@ send a chat message to</property>
</child>
</widget>
<widget class="GtkDialog" id="change_password_dialog">
<property name="border_width">4</property>
<property name="visible">True</property>
<property name="title" translatable="yes">dialog2</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox7">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area6">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancelbutton2">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="okbutton2">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox54">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">10</property>
<child>
<widget class="GtkHBox" id="hbox2928">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">10</property>
<child>
<widget class="GtkImage" id="image416">
<property name="visible">True</property>
<property name="stock">gtk-dialog-question</property>
<property name="icon_size">6</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">20</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label208">
<property name="visible">True</property>
<property name="label" translatable="yes">Enter the new password you want for this account</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="password1_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">False</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label209">
<property name="visible">True</property>
<property name="label" translatable="yes">Enter it again to confirm :</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="password2_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">False</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>