mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-21 14:04:15 +00:00
lib/FHEM/Core/Authentication/Passwords.pm: fix rename bug, new method to create object
git-svn-id: https://svn.fhem.de/fhem/trunk@24312 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
02b579f75b
commit
5f30363026
@ -1,5 +1,8 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- bugfix: lib/FHEM/Core/Authentication/Passwords.pm:
|
||||||
|
fix rename bug, new method to create object
|
||||||
|
You musst pass a instance TYPE to the function if you create a objekt
|
||||||
- change: move lib/FHEM/Core/Password/Utils.pm to
|
- change: move lib/FHEM/Core/Password/Utils.pm to
|
||||||
lib/FHEM/Core/Authentication/Passwords.pm
|
lib/FHEM/Core/Authentication/Passwords.pm
|
||||||
- feature: 30_HUEBridge: enable autocreation of sensors for deconz
|
- feature: 30_HUEBridge: enable autocreation of sensors for deconz
|
||||||
|
@ -32,6 +32,8 @@ use 5.008;
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
|
our $VERSION = 1.0;
|
||||||
|
|
||||||
|
|
||||||
### eigene Funktionen exportieren
|
### eigene Funktionen exportieren
|
||||||
require Exporter;
|
require Exporter;
|
||||||
@ -57,10 +59,11 @@ our %EXPORT_TAGS = (
|
|||||||
|
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my $self = {
|
my $type = shift;
|
||||||
name => undef,
|
my $self = {
|
||||||
};
|
TYPE => $type,
|
||||||
|
};
|
||||||
|
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
return $self;
|
return $self;
|
||||||
@ -71,7 +74,7 @@ sub setStorePassword {
|
|||||||
my $name = shift;
|
my $name = shift;
|
||||||
my $password = shift // return(undef,q{no password given});
|
my $password = shift // return(undef,q{no password given});
|
||||||
|
|
||||||
my $index = $::defs{$name}->{TYPE} . '_' . $name . '_passkey';
|
my $index = $self->{TYPE} . '_' . $name . '_passkey';
|
||||||
my ($x,$y) = ::gettimeofday();
|
my ($x,$y) = ::gettimeofday();
|
||||||
my $salt = substr(sprintf("%08X", rand($y)*rand($x)),0,8);
|
my $salt = substr(sprintf("%08X", rand($y)*rand($x)),0,8);
|
||||||
my $key = ::getUniqueId() . $index . $salt;
|
my $key = ::getUniqueId() . $index . $salt;
|
||||||
@ -104,7 +107,7 @@ sub setDeletePassword {
|
|||||||
my $name = shift;
|
my $name = shift;
|
||||||
|
|
||||||
my $err;
|
my $err;
|
||||||
$err = ::setKeyValue( $::defs{$name}->{TYPE} . '_' . $name . '_passkey', undef );
|
$err = ::setKeyValue( $self->{TYPE} . '_' . $name . '_passkey', undef );
|
||||||
|
|
||||||
return(undef,$err)
|
return(undef,$err)
|
||||||
if ( defined($err) );
|
if ( defined($err) );
|
||||||
@ -116,7 +119,7 @@ sub getReadPassword {
|
|||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $name = shift;
|
my $name = shift;
|
||||||
|
|
||||||
my $index = $::defs{$name}->{TYPE} . '_' . $name . '_passkey';
|
my $index = $self->{TYPE} . '_' . $name . '_passkey';
|
||||||
my ( $password, $err, $salt );
|
my ( $password, $err, $salt );
|
||||||
|
|
||||||
::Log3($name, 4, qq{password Keystore handle for Device ($name) - Read password from file});
|
::Log3($name, 4, qq{password Keystore handle for Device ($name) - Read password from file});
|
||||||
@ -196,11 +199,11 @@ FHEM::Core::Authentication::Passwords - FHEM extension for password handling
|
|||||||
|
|
||||||
=head1 VERSION
|
=head1 VERSION
|
||||||
|
|
||||||
This document describes FHEM::Core::Authentication::Passwords version 0.9
|
This document describes FHEM::Core::Authentication::Passwords version 1.0
|
||||||
|
|
||||||
=head1 CONSTRUCTOR
|
=head1 CONSTRUCTOR
|
||||||
|
|
||||||
FHEM::Core::Authentication::Passwords->new();
|
FHEM::Core::Authentication::Passwords->new(<INSTANZTYPE>);
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
@ -213,13 +216,16 @@ FHEM::Core::Authentication::Passwords->new();
|
|||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
Store new Password
|
Store new Password
|
||||||
$hash->{helper}->{passwdobj}->setStorePassword('PASSWORD');
|
$hash->{helper}->{passwdobj}->setStorePassword($name,'PASSWORD');
|
||||||
|
|
||||||
Read Password
|
Read Password
|
||||||
$hash->{helper}->{passwdobj}->getReadPassword();
|
$hash->{helper}->{passwdobj}->getReadPassword($name);
|
||||||
|
|
||||||
|
|
||||||
|
Delete Password
|
||||||
|
$hash->{helper}->{passwdobj}->setDeletePassword($name);
|
||||||
|
|
||||||
|
Rename Password
|
||||||
|
$hash->{helper}->{passwdobj}->getRename($newname,$oldname);
|
||||||
|
|
||||||
=head1 EXPORT
|
=head1 EXPORT
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user