From d53c49b0c47dd24d0b01f4200ceef457043c4a34 Mon Sep 17 00:00:00 2001
From: Rasmus Fuhse <fuhse@data-quest.de>
Date: Thu, 1 Jun 2023 14:18:16 +0200
Subject: [PATCH] Revert "add NSI modifications"

This reverts commit 35ba076cf685392463062e548e3f2909e38ef914.
---
 app/controllers/studip_controller.php         |  4 +-
 .../auth_plugins/StudipAuthNsi.class.php      | 76 -------------------
 templates/loginform.php                       |  7 +-
 3 files changed, 3 insertions(+), 84 deletions(-)
 delete mode 100644 lib/classes/auth_plugins/StudipAuthNsi.class.php

diff --git a/app/controllers/studip_controller.php b/app/controllers/studip_controller.php
index 6c12a56cf43..1ddce67db50 100644
--- a/app/controllers/studip_controller.php
+++ b/app/controllers/studip_controller.php
@@ -210,11 +210,9 @@ abstract class StudipController extends Trails_Controller
                     break;
 
                 case 'option':
-                    //NSI MOD BEGIN
-                    if (preg_match('/[^\\w\.,-]/', $arg)) {
+                    if (preg_match('/[^\\w,-]/', $arg)) {
                         throw new Trails_Exception(400);
                     }
-                    //NSI MOD END
                     break;
 
                 case 'sorm':
diff --git a/lib/classes/auth_plugins/StudipAuthNsi.class.php b/lib/classes/auth_plugins/StudipAuthNsi.class.php
deleted file mode 100644
index a41ec89e5a8..00000000000
--- a/lib/classes/auth_plugins/StudipAuthNsi.class.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-// +---------------------------------------------------------------------------+
-// This file is part of Stud.IP
-// StudipAuthStandard.class.php
-// Basic Stud.IP authentication, using the Stud.IP database
-//
-// Copyright (c) 2003 André Noack <noack@data-quest.de>
-// Suchi & Berg GmbH <info@data-quest.de>
-// +---------------------------------------------------------------------------+
-// This program 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 any later version.
-// +---------------------------------------------------------------------------+
-// This program 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.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-// +---------------------------------------------------------------------------+
-
-/**
- * Basic Stud.IP authentication, using the Stud.IP database
- *
- * Basic Stud.IP authentication, using the Stud.IP database
- *
- * @access   public
- * @author   André Noack <noack@data-quest.de>
- * @package
- */
-class StudipAuthNsi extends StudipAuthStandard
-{
-
-    public $error_head = 'NSI-Portal';
-
-    /**
-     *
-     *
-     *
-     * @access public
-     *
-     */
-    function isAuthenticated($username, $password)
-    {
-        $username = mb_strtolower($username);
-        $user = User::findByUsername($username);
-        if (!$user || !$password || mb_strlen($password) > 72) {
-            $this->error_msg= _("Ungültige Benutzername/Passwort-Kombination!") ;
-            return false;
-        } elseif ($user->auth_plugin != $this->plugin_name) {
-            $this->error_msg = sprintf(_("Dieser Benutzername wird bereits über %s authentifiziert!"),$user->auth_plugin) ;
-            return false;
-        } else {
-            $pass = $user->password;
-        }
-        if (mb_strlen($pass) != 60) {
-            $this->error_msg = sprintf(_("Sie benötigen die Anmeldedaten des NSI-Portals. Bitte stellen Sie sicher, dass Sie sich bereits einmal im
-%s angemeldet haben. Bei einer Passwortänderung im NSI-Portal kann es bis zu 24 Stunden dauern, bis die Änderung in Stud.IP wirksam wird."), '<a href="https://www.nsi-hsvn.de/login.html" target="_blank">NSI-Portal</a>') ;
-            return false;
-        }
-        $hasher = UserManagement::getPwdHasher();
-        $check = $hasher->CheckPassword($password, $pass);
-        if (!$check) {
-            $this->error_msg= _("Das Passwort ist falsch!");
-            return false;
-        } else {
-            return true;
-        }
-    }
-
-}
diff --git a/templates/loginform.php b/templates/loginform.php
index a7d1aab10bc..edbd565f823 100644
--- a/templates/loginform.php
+++ b/templates/loginform.php
@@ -74,12 +74,9 @@ if (!match_route('web_migrate.php')) {
             <? if (Config::get()->ENABLE_REQUEST_NEW_PASSWORD_BY_USER && in_array('Standard', $GLOBALS['STUDIP_AUTH_PLUGIN'])): ?>
                 <a href="<?= URLHelper::getLink('dispatch.php/new_password?cancel_login=1') ?>">
             <? else: ?>
-                <? /* MOD NSI BEGIN */ ?>
-                <!-- <a href="mailto:<?= $GLOBALS['UNI_CONTACT'] ?>?subject=<?= rawurlencode('Stud.IP Passwort vergessen - '.Config::get()->UNI_NAME_CLEAN) ?>&amp;body=<?= rawurlencode('Ich habe mein Passwort vergessen. Bitte senden Sie mir ein Neues.\nMein Nutzername: ' . htmlReady($uname) . "\n") ?>"> -->
-                <a href="https://www.nsi-hsvn.de/login.html?tx_nsiportal_login%5Baction%5D=requestPasswordUpdateForm&tx_nsiportal_login%5Bcontroller%5D=Account&cHash=4ca05d2bd995bbb12b5b107570a03e89">Passwort vergessen? - Bitte benutzen Sie das NSI-Portal
+                <a href="mailto:<?= $GLOBALS['UNI_CONTACT'] ?>?subject=<?= rawurlencode('Stud.IP Passwort vergessen - '.Config::get()->UNI_NAME_CLEAN) ?>&amp;body=<?= rawurlencode('Ich habe mein Passwort vergessen. Bitte senden Sie mir ein Neues.\nMein Nutzername: ' . htmlReady($uname) . "\n") ?>">
             <? endif; ?>
-                    <!--<?= _('Passwort vergessen') ?> -->
-                    <? /* MOD NSI END */ ?>
+                    <?= _('Passwort vergessen') ?>
                 </a>
             <? if ($self_registration_activated): ?>
                 /
-- 
GitLab