98_GoogleAuth.pm: under development (code cleanup)
git-svn-id: https://svn.fhem.de/fhem/trunk@13078 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -1,5 +1,18 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
=pod
|
||||||
|
#
|
||||||
|
# Development history
|
||||||
|
#
|
||||||
|
# 2017-01-15 - first check in to ./contrib
|
||||||
|
# 2017-01-15 - added: direct QR display after set
|
||||||
|
# added: attribute ga_qrSize
|
||||||
|
# added: FW_detailFn
|
||||||
|
# added: attribute ga_labelName
|
||||||
|
# added: reading lastCheck
|
||||||
|
#
|
||||||
|
=cut
|
||||||
|
|
||||||
package main;
|
package main;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
@@ -21,7 +34,7 @@ sub GoogleAuth_Initialize($) {
|
|||||||
$hash->{GetFn} = "GoogleAuth_Get";
|
$hash->{GetFn} = "GoogleAuth_Get";
|
||||||
$hash->{FW_detailFn} = "GoogleAuth_Detail";
|
$hash->{FW_detailFn} = "GoogleAuth_Detail";
|
||||||
# $hash->{AttrFn} = "GoogleAuth_Attr";
|
# $hash->{AttrFn} = "GoogleAuth_Attr";
|
||||||
$hash->{AttrList} = "ga_qrsize ".
|
$hash->{AttrList} = "ga_qrSize ".
|
||||||
"ga_labelName ".
|
"ga_labelName ".
|
||||||
"$readingFnAttributes";
|
"$readingFnAttributes";
|
||||||
}
|
}
|
||||||
@@ -57,7 +70,7 @@ sub GoogleAuth_Set($$@) {
|
|||||||
setKeyValue("googleAuth$name",$secret_base32); # write to fhem keystore
|
setKeyValue("googleAuth$name",$secret_base32); # write to fhem keystore
|
||||||
|
|
||||||
my $label = AttrVal($name,'ga_labelName',"FHEM Authentication $name");
|
my $label = AttrVal($name,'ga_labelName',"FHEM Authentication $name");
|
||||||
my $qrsize = AttrVal($name,'ga_qrsize','200x200');
|
my $qrsize = AttrVal($name,'ga_qrSize','200x200');
|
||||||
my $url = "otpauth://totp/$label?secret=$secret_base32";
|
my $url = "otpauth://totp/$label?secret=$secret_base32";
|
||||||
my $qr_url = "https://chart.googleapis.com/chart?cht=qr&chs=$qrsize"."&chl=".uri_escape($url);
|
my $qr_url = "https://chart.googleapis.com/chart?cht=qr&chs=$qrsize"."&chl=".uri_escape($url);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user