summaryrefslogtreecommitdiff
path: root/FS/FS/Password_Mixin.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-02-25 15:16:35 -0800
committerMark Wells <mark@freeside.biz>2016-02-25 17:11:10 -0800
commitfa97f29ea43276a6f2636e1f251c775c7fa9e67c (patch)
treef0ee4d7db2daf9a1b6459733ba81abba2d4f9cd0 /FS/FS/Password_Mixin.pm
parent50f247ce6da7497428ce772d3c37c6cba3b9c736 (diff)
allow records with password history to be deleted, from #32456
Diffstat (limited to 'FS/FS/Password_Mixin.pm')
-rw-r--r--FS/FS/Password_Mixin.pm20
1 files changed, 20 insertions, 0 deletions
diff --git a/FS/FS/Password_Mixin.pm b/FS/FS/Password_Mixin.pm
index 3fb787c..ac7ba50 100644
--- a/FS/FS/Password_Mixin.pm
+++ b/FS/FS/Password_Mixin.pm
@@ -215,6 +215,26 @@ sub insert_password_history {
}
+=item delete_password_history;
+
+Removes all password history records attached to this object, in preparation
+to delete the object.
+
+=cut
+
+sub delete_password_history {
+ my $self = shift;
+ my @records = qsearch('password_history', {
+ $self->password_history_key => $self->get($self->primary_key)
+ });
+ my $error = '';
+ foreach (@records) {
+ $error ||= $_->delete;
+ }
+ return $error . ' (clearing password history)' if $error;
+ '';
+}
+
=item _blowfishcrypt PASSWORD
For internal use: takes PASSWORD and returns a new