From c5922713bc199600bc8c203155a4016c9d24cbbc Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 27 May 2014 15:20:05 -0700 Subject: rt 4.0.20 (RT#13852) --- rt/lib/RT/User.pm | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'rt/lib/RT/User.pm') diff --git a/rt/lib/RT/User.pm b/rt/lib/RT/User.pm index 018ac8a62..af4a6ad99 100755 --- a/rt/lib/RT/User.pm +++ b/rt/lib/RT/User.pm @@ -957,7 +957,7 @@ sub IsPassword { my $hash = MIME::Base64::decode_base64($stored); # Decoding yields 30 byes; first 4 are the salt, the rest are substr(SHA256,0,26) my $salt = substr($hash, 0, 4, ""); - return 0 unless substr(Digest::SHA::sha256($salt . Digest::MD5::md5($value)), 0, 26) eq $hash; + return 0 unless substr(Digest::SHA::sha256($salt . Digest::MD5::md5(encode_utf8($value))), 0, 26) eq $hash; } elsif (length $stored == 32) { # Hex nonsalted-md5 return 0 unless Digest::MD5::md5_hex(encode_utf8($value)) eq $stored; @@ -1390,6 +1390,28 @@ sub SetPreferences { } } +=head2 DeletePreferences NAME/OBJ VALUE + +Delete user preferences associated with given object or name. + +=cut + +sub DeletePreferences { + my $self = shift; + my $name = _PrefName( shift ); + + return (0, $self->loc("No permission to set preferences")) + unless $self->CurrentUserCanModify('Preferences'); + + my $attr = RT::Attribute->new( $self->CurrentUser ); + $attr->LoadByNameAndObject( Object => $self, Name => $name ); + if ( $attr->Id ) { + return $attr->Delete; + } + + return (0, $self->loc("Preferences were not found")); +} + =head2 Stylesheet Returns a list of valid stylesheets take from preferences. -- cgit v1.2.1