[Rt-commit] rt branch, admin_ui, updated. 4160d9b43f6502de37cfd4785c96d7645192674d

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Jan 21 02:07:53 EST 2010


The branch, admin_ui has been updated
       via  4160d9b43f6502de37cfd4785c96d7645192674d (commit)
      from  572b1188518bd2d4d42f088319c33c9da352f294 (commit)

Summary of changes:
 lib/RT/Action/EditUserPrefsMe.pm |   79 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 79 insertions(+), 0 deletions(-)
 create mode 100644 lib/RT/Action/EditUserPrefsMe.pm

- Log -----------------------------------------------------------------
commit 4160d9b43f6502de37cfd4785c96d7645192674d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Jan 21 15:07:45 2010 +0800

    EditUserPrefsMe action

diff --git a/lib/RT/Action/EditUserPrefsMe.pm b/lib/RT/Action/EditUserPrefsMe.pm
new file mode 100644
index 0000000..7c9bcf5
--- /dev/null
+++ b/lib/RT/Action/EditUserPrefsMe.pm
@@ -0,0 +1,79 @@
+use strict;
+use warnings;
+
+package RT::Action::EditUserPrefsMe;
+use base qw/RT::Action::UpdateUser RT::Action::EditUserPrefs/;
+use Scalar::Defer qw/defer/;
+
+use Jifty::Param::Schema;
+use Jifty::Action schema {
+    param 'reset_auth_token' => render as 'InlineButton',
+      label              is _('reset auth token'),
+      hints              is _(
+'All iCal feeds embed a secret token which authorizes you.  If the URL one of your iCal feeds got exposed to the outside world, you can get a new secret, <b>breaking all existing iCal feeds</b> below.'
+      );
+    param 'id' => render as 'hidden',
+          default is defer { __PACKAGE__->user->id };
+};
+
+=head2 take_action
+
+=cut
+
+sub take_action {
+    my $self = shift;
+
+    if ( $self->argument_value('reset_auth_token') ) {
+        my ( $status, $msg ) = $self->user->generate_auth_token;
+        Jifty->log->error($msg) unless $status;
+        $self->result->message( _('Reset auth token') );
+        return 1;
+    }
+
+    # now let's deal with columns
+    $self->record( $self->user );
+    $self->SUPER::take_action(@_);
+    $self->report_success;
+
+    return 1;
+}
+
+sub sections {
+    return (
+        {
+            title  => 'Identity',
+            fields => [qw/id name email real_name nickname lang time_zone/],
+        },
+        (
+            RT->config->get('web_external_auth')
+              && !RT->config->get('web_fallback_to_internal_auth')
+            ? ()
+            : {
+                title  => 'Password',
+                fields => [qw/password password_confirm/],
+            },
+        ),
+        {
+            title  => 'Phone numbers',
+            fields => [
+                qw/home_phone work_phone mobile_phone
+                  pager_phone/
+            ],
+        },
+        {
+            title => 'Location',
+            fields =>
+              [qw/organization address1 address2 city state zip country/],
+        },
+        {
+            title  => 'Signature',
+            fields => [qw/signature/],
+        },
+        {
+            title  => 'Secret authentication token',
+            fields => [qw/reset_auth_token/],
+        },
+    );
+}
+
+1;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list