X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fimsettings.php;h=0aa7631dc2c2fc59314ce269aad42cf65a4985cb;hb=c55e3089c555c0a9f12b997f25b7f4f397a0e2c6;hp=d1ed48efb38912de47e27a5158cafa3aff3e834a;hpb=4b8ae3e33937b4dacd2acb17d98050684ce41823;p=quix0rs-gnu-social.git diff --git a/actions/imsettings.php b/actions/imsettings.php index d1ed48efb3..0aa7631dc2 100644 --- a/actions/imsettings.php +++ b/actions/imsettings.php @@ -35,6 +35,7 @@ class ImsettingsAction extends SettingsAction { 'id' => 'imsettings', 'action' => common_local_url('imsettings'))); + common_hidden('token', common_session_token()); common_element('h2', NULL, _('Address')); @@ -75,6 +76,9 @@ class ImsettingsAction extends SettingsAction { common_checkbox('jabberreplies', _('Send me replies through Jabber/GTalk from people I\'m not subscribed to.'), $user->jabberreplies); + common_checkbox('jabbermicroid', + _('Publish a MicroID for my Jabber/GTalk address.'), + $user->jabbermicroid); common_submit('save', _('Save')); common_element_end('form'); @@ -95,6 +99,13 @@ class ImsettingsAction extends SettingsAction { function handle_post() { + # CSRF protection + $token = $this->trimmed('token'); + if (!$token || $token != common_session_token()) { + $this->show_form(_('There was a problem with your session token. Try again, please.')); + return; + } + if ($this->arg('save')) { $this->save_preferences(); } else if ($this->arg('add')) { @@ -113,6 +124,7 @@ class ImsettingsAction extends SettingsAction { $jabbernotify = $this->boolean('jabbernotify'); $updatefrompresence = $this->boolean('updatefrompresence'); $jabberreplies = $this->boolean('jabberreplies'); + $jabbermicroid = $this->boolean('jabbermicroid'); $user = common_current_user(); @@ -125,6 +137,7 @@ class ImsettingsAction extends SettingsAction { $user->jabbernotify = $jabbernotify; $user->updatefrompresence = $updatefrompresence; $user->jabberreplies = $jabberreplies; + $user->jabbermicroid = $jabbermicroid; $result = $user->update($original);