diff options
author | Mark Wells <mark@freeside.biz> | 2016-02-25 15:16:35 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2016-02-27 20:27:37 -0800 |
commit | 769743058fc3b00aac7d3c084391198c7f08d23d (patch) | |
tree | 014350c805e6639cfdefeaf372a5e910cf56e49a /FS/FS/Password_Mixin.pm | |
parent | e476b3f5c0dd830f9c3698a1a9a8ba8848e6a490 (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.pm | 20 |
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 |