diff --git a/README.md b/README.md index b3614f8..d383199 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # wmdeit_wmdepasswd -Password generation/reset tool for WP:@ mail addresses \ No newline at end of file +Password generation/reset tool for WP:@ mail addresses + +This works only in conjunction with nubuilder diff --git a/email.tpl b/email.tpl new file mode 100644 index 0000000..1137acc --- /dev/null +++ b/email.tpl @@ -0,0 +1,14 @@ + +

Bitte gib deine E-Mail-Adresse ein!

+

Wir werden dir eine E-Mail senden, mit der du Zugangsdaten für +deine WP:@-Adresse anfordern kannst.

+
+ + + +
+ diff --git a/footer.tpl b/footer.tpl new file mode 100644 index 0000000..fe612ad --- /dev/null +++ b/footer.tpl @@ -0,0 +1,3 @@ +

© 2019ff Wikimedia Deutschland e.V. – ImpressumDatenschutz

+ + diff --git a/header.tpl b/header.tpl new file mode 100644 index 0000000..f12217c --- /dev/null +++ b/header.tpl @@ -0,0 +1,9 @@ + + + + +<?php echo $title ?> + + + + diff --git a/index.php b/index.php new file mode 100644 index 0000000..858a5a1 --- /dev/null +++ b/index.php @@ -0,0 +1,43 @@ + +

+Wir haben dir nun eine E-Mail mit einem Link zum +zurücksetzen deines Passworts gesendet, sofern +

+ diff --git a/tfunc.php b/tfunc.php new file mode 100644 index 0000000..8545e4b --- /dev/null +++ b/tfunc.php @@ -0,0 +1,180 @@ +$secret]); +} + + +function wmde_getCommunityId( $email, $private = false ) +{ + if (!$private){ + $sql = "SELECT community.community_id FROM community LEFT JOIN community_mail ON + community_mail.cmailkey = community.community_id WHERE + community_mail.cmail = :cmail OR community.email = :email"; + $sqlargs = [':cmail'=>$email,':email'=>$email]; + } + else { + $sql = "SELECT community.community_id FROM community + WHERE community.email = :email"; + $sqlargs = [':email'=>$email]; + } + +// echo "Cpommunity Query = $sql - $email\n"; + + $t = nuRunQuery($sql, $sqlargs); +// var_dump($t); + + $a = db_fetch_array($t); + if ($a) { + return $a['community_id']; + } + return null; +} + +function showReset() +{ + global $nuDB; + $title = "WP:@ Passwort anfordern"; + include "email.tpl"; +/* + + +
+ + + +
+ +*/ +} + +function getpw() +{ + global $nuDB; + $sql = "SELECT * FROM community WHERE email = :email"; + $t = nuRunQuery($sql,[':email' => 'tube@surfpoeten.de']); + var_dump($t); + $a = db_fetch_array($t); + var_dump($a); + +} + +function wmde_getWikiMails($community_id) +{ + $sql = "SELECT cmail FROM community LEFT JOIN community_mail ON + community_mail.cmailkey = community.community_id WHERE + community.community_id = :community_id"; + $t = nuRunQuery($sql,[':community_id' => $community_id]); + $mails = array(); + while ( $a = db_fetch_array($t) ) + { + array_push($mails,$a['cmail']); + } + return $mails; +} + +function wmde_setPass($community_id,$password) +{ + $pass = password_hash($password,PASSWORD_BCRYPT ); + $sql = "UPDATE community SET pass='$pass' WHERE community_id = :id"; +// echo "SQL: $sql\n"; + $t = nuRunQuery($sql,[':id' => $community_id],true); +// var_dump($t); + return $t; +} + +function wmde_getCommunityIdBySecret($secret) +{ + $sql = "SELECT community_reset_id FROM community_reset WHERE secret = :secret"; +// AND valid_until > NOW() "; + + $t = nuRunQuery($sql, ['secret' => $secret]); +// echo "the t $secret\n"; +// var_dump($t); + + $a = db_fetch_array($t); +// echo "the a\n"; +// var_dump($a); + + if ($a) { + return $a['community_reset_id']; + } + return null; +} + + +function wmde_setPassByMail($email,$pass) +{ + $id = wmde_getCommunityId($email); + if (!$id) + return false; + return wmde_setPass($id,$pass); +} + + +function wmde_sendPasswordResetMail($email) +{ + $community_id = wmde_getCommunityId($email,false); +// var_dump($community_id); +// var_dump($email); + if (!$community_id) + return false; + + $secret = wmde_createPasswordResetSecret($community_id); + if (!$secret ) { + return false; + } + + include "mailtext.tpl"; + + $sender='noc@wikipedia.de'; + $sendmail = "/usr/sbin/sendmail"; + $text = "To: $email\n"; + $text.= "From: Wikimedia Team IT \n"; + $text.= "MIME-Version: 1.0\n"; + $text.= "Content-Transfer-Encoding: 8bit\n"; + $text.= "Content-Type: text/plain; charset=utf-8\n"; + $text.= "Subject: $mail_subject\n\n"; + $text.= $mail_text; + + + $cmd = "echo '$text' | $sendmail -f noc@wikipedia.de $email"; + exec ($cmd); + return $secret; + +} + + + + diff --git a/wmde_logo_vert_schwarz.png b/wmde_logo_vert_schwarz.png new file mode 100644 index 0000000..ab6a708 Binary files /dev/null and b/wmde_logo_vert_schwarz.png differ diff --git a/wmdepasswd.css b/wmdepasswd.css new file mode 100644 index 0000000..94b83f7 --- /dev/null +++ b/wmdepasswd.css @@ -0,0 +1,14 @@ + +* { + font-family: Montserrat, sans-serif; + font-size: 100%; /*1vw;*/ +} + +body {padding:1em; max-width: 60ex; text-align: justify;} + +img, body { display: block; margin-left: auto; margin-right: auto; } +dt { font-weight: bold; } + +.notice { color: green; } + +.imprint { color: grey; } diff --git a/wrongreset.tpl b/wrongreset.tpl new file mode 100644 index 0000000..56c9024 --- /dev/null +++ b/wrongreset.tpl @@ -0,0 +1,7 @@ + +

Der vom dir aufgerufene Link zum Setzen des WP:@-Passworts +ist nicht oder nicht mehr gültig.

+

+Um einen gültigen Link zu erhalten, musst du erneut Zugangsdaten anfordern. +

+ diff --git a/yourpassword.tpl b/yourpassword.tpl new file mode 100644 index 0000000..22de447 --- /dev/null +++ b/yourpassword.tpl @@ -0,0 +1,38 @@ + +

Hier sind deine Zugangsdaten, um Mails mit deiner WP:@-Adresse +zu versenden. Bitte notiere dir diese Daten an einem sicheren Ort (z.B. +in deiner durch KeePassXC gesicherten Passwortdatenbank).

+ +

Ein erneuter Aufruf dieser Seite ist nicht möglich, es sei denn, du +forderst ein neues Passwort an.

+
+
Absenderadresse(n):
+
+"; + } + +?> +
+
Postausgangsserver:
email.wikimedia.de
+
Port:
587
+
Verschlüsselung:
StartTLS
+
WP:@-Benutzername:
+
+ +
+
WP:@-Passwort:
+
+

+Hilfe bei der Einrichtung in verschiedenen E-Mail-Anwendungen kannst du auf der Seite +WP:@/Anleitung_E-Mail-Konfiguration +finden. +

+