Skip to content

Commit

Permalink
abandon all hope...
Browse files Browse the repository at this point in the history
  • Loading branch information
M4LuZ authored and andygrunwald committed Sep 6, 2018
1 parent fcb42ef commit 8cb99e4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
31 changes: 19 additions & 12 deletions modules/usrmgr/Classes/UserManager.php
@@ -1,23 +1,25 @@
<?php

namespace LanSuite\Module\UsrMgr;

class UserManager {
class UserManager
{

/**
* @var \LanSuite\Module\Mail\Mail
*/
private $mail = null;

public function __construct(\LanSuite\Module\Mail\Mail $mail) {
public function __construct(\LanSuite\Module\Mail\Mail $mail)
{
$this->mail = $mail;
}

/**
* @param int $id User ID
* @return int
*/
public function SendVerificationEmail($id) {
public function SendVerificationEmail($id)
{
global $cfg, $db, $mail, $func;

$verification_code = '';
Expand Down Expand Up @@ -62,7 +64,8 @@ public function SendVerificationEmail($id) {
* @param int $userid User ID
* @return void
*/
public function LockAccount($userid) {
public function LockAccount($userid)
{
global $db;

$db->qry("UPDATE %prefix%user SET locked = 1 WHERE userid=%int%", $userid);
Expand All @@ -73,7 +76,8 @@ public function LockAccount($userid) {
* @param int $userid User ID
* @return void
*/
public function UnlockAccount($userid) {
public function UnlockAccount($userid)
{
global $db;

$db->qry("UPDATE %prefix%user SET locked = 0 WHERE userid=%int%", $userid);
Expand All @@ -82,15 +86,17 @@ public function UnlockAccount($userid) {
/**
* @return int
*/
public function GeneratePassword() {
public function GeneratePassword()
{
return rand(10000, 99999);
}

/**
* @param string $code
* @return int 1 = OK, 2 = Wrong length, 3 = Checksum error, 4 = Expired
*/
public function CheckPerso($code) {
public function CheckPerso($code)
{
$perso_block = explode("<", $code);
$perso_cs1 = substr($perso_block[0], 9, 1);
$perso_cs2 = substr($perso_block[2], 6, 1);
Expand All @@ -100,7 +106,7 @@ public function CheckPerso($code) {

// Length Check
if ((strlen($code) != 36) ||
(strlen($perso_block[0]) != 11) || (strlen($perso_block[2]) != 7) || (strlen($perso_block[3]) != 7) || (strlen($perso_block[10]) != 1)) {
(strlen($perso_block[0]) != 11) || (strlen($perso_block[2]) != 7) || (strlen($perso_block[3]) != 7) || (strlen($perso_block[10]) != 1)) {
return 2;
// Chechsum Check
} else {
Expand Down Expand Up @@ -149,7 +155,8 @@ public function CheckPerso($code) {
* @param int $type
* @return bool
*/
public function SendSignonMail($type = 0) {
public function SendSignonMail($type = 0)
{
global $cfg, $func, $mail, $db, $auth;

switch ($type) {
Expand Down Expand Up @@ -217,7 +224,8 @@ public function SendSignonMail($type = 0) {
/**
* @return bool
*/
public function WriteXMLStatFile() {
public function WriteXMLStatFile()
{
global $cfg, $db, $config;

$xml = new \LanSuite\XML();
Expand Down Expand Up @@ -289,5 +297,4 @@ public function WriteXMLStatFile() {
}
return true;
}

}
10 changes: 1 addition & 9 deletions modules/usrmgr/remind.php
@@ -1,5 +1,4 @@
<?php

$dsp->NewContent(t('Passwort vergessen'), t('Mit diesem Modul kannst du dir ein neues Passwort generieren lassen'));

if (!$cfg['sys_internet']) {
Expand Down Expand Up @@ -44,15 +43,8 @@
$pwrecoverytxt = str_replace("%PARTYNAME%", $cfg['sys_page_title'], $pwrecoverytxt); //replace party name
//now assemble it all into a mail
$mail->create_inet_mail(
$user_data['username'],
$_POST['pwr_mail'],
$cfg['usrmgr_pwrecovery_subject'],
$pwrecoverytxt
$user_data['username'], $_POST['pwr_mail'], $cfg['usrmgr_pwrecovery_subject'], $pwrecoverytxt
);




$func->confirmation(t('Dir wurde nun eine Freischalte-URL an die angegebene Emailadresse gesendet. Mit dem Aufruf dieser URL wird dir neues Passwort generiert werden.'), "index.php");
} else {
$func->information(t('Die von dir eigegebene Email existiert nicht in der Datenbank'), "index.php?mod=usrmgr&action=pwrecover&step=1");
Expand Down

0 comments on commit 8cb99e4

Please sign in to comment.