diff --git a/fhem/contrib/98_GoogleAuth.pm b/fhem/contrib/98_GoogleAuth.pm index 4484332ed..92416eb22 100644 --- a/fhem/contrib/98_GoogleAuth.pm +++ b/fhem/contrib/98_GoogleAuth.pm @@ -1,16 +1,57 @@ # $Id$ +# License & technical informations =pod # +################################################################ +# +# This script is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The GNU General Public License can be found at +# http://www.gnu.org/copyleft/gpl.html. +# A copy is found in the textfile GPL.txt and important notices to the license +# from the author is found in LICENSE.txt distributed with these scripts. +# +# This script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# This copyright notice MUST APPEAR in all copies of the script! +# +# Homepage: http://www.fhem.de +# +################################################################ +# +# Module 98_GoogleAuth.pm +# written by pandabaer_de, revised by betateilchen +# +# based on informations from this website +# https://blog.darkpan.com/article/6/Perl-and-Google-Authenticator.html +# +# requires additional perl modules +# Convert::Base32 Authen::OATH Crypt::URandom +# +# on Debian systems, use apt-get to install appropriate packages +# libconvert-base32-perl libauthen-oath-perl libcrypt-urandom-perl +# +################################################################ +# +=cut + # Development history +=pod # # 2017-01-15 - first commit 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 -# # removed: reading qr_url # added: show link to qrcode and key for manual use # in device details @@ -19,6 +60,8 @@ # added: attribute ga_showKey # attribute ga_showLink # added: function gAuth(,) for easy use +# added: FW_summaryFn +# added: commandref documentation EN # =cut @@ -26,8 +69,6 @@ package main; use strict; use warnings; -## apt-get install libconvert-base32-perl libauthen-oath-perl libcrypt-urandom-perl - use Convert::Base32; use Authen::OATH; use URI::Escape; @@ -42,7 +83,9 @@ sub GoogleAuth_Initialize($) { $hash->{SetFn} = "GoogleAuth_Set"; $hash->{GetFn} = "GoogleAuth_Get"; $hash->{FW_detailFn} = "GoogleAuth_Detail"; + $hash->{FW_summaryFn} = "GoogleAuth_Detail"; # $hash->{AttrFn} = "GoogleAuth_Attr"; + $hash->{AttrList} = "ga_labelName ". "ga_qrSize:100x100,200x200,300x300,400x400 ". "ga_showKey:0,1 ". @@ -120,8 +163,6 @@ sub GoogleAuth_Detail($@) { my ($FW_wname, $name, $room, $pageHash) = @_; my $qr_url = _ga_make_url($name); my $secret_base32 = getKeyValue("googleAuth$name"); # read from fhem keystore - -# my $qr_url = ReadingsVal($d,'qr_url',undef); return unless defined($qr_url); my $ret = ""; $ret .= ""; @@ -134,7 +175,13 @@ sub GoogleAuth_Detail($@) { return $ret; } - +sub GoogleAuth_Summary($$$$) { + my ($FW_wname, $name, $room, $pageHash) = @_; + my $qr_url = _ga_make_url($name); + my $secret_base32 = getKeyValue("googleAuth$name"); # read from fhem keystore + return unless defined($qr_url); + return ""; +} # helper functions sub _ga_make_url($) { @@ -166,15 +213,121 @@ sub gAuth($$) { =pod =item helper -=item summary Module to use GoogleAuthnticator +=item summary Module to use GoogleAuthenticator =item summary_DE Modul zur Nutzung von GoogleAuthenticator =begin html - -

GoogleAuthenticator

+ +

GoogleAuth

+ -
=end html +=begin html_DE + + +

GoogleAuth

+ +=end html_DE + =cut \ No newline at end of file
<\/a>