refactoring login form, add logout to the tests
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
/// @file common settings and includes for the participo api
|
/// @file common settings and includes for the participo api
|
||||||
/// - set locale to german
|
/// - set locale to german
|
||||||
setlocale(LC_ALL, "de_DE@euro", "de_DE", "de", "ge");
|
setlocale(LC_ALL, "de_DE@euro", "de_DE", "de", "ge");
|
||||||
/// - extend the include search path for
|
/// - extend the include search path for:
|
||||||
set_include_path(implode(
|
set_include_path(implode(
|
||||||
PATH_SEPARATOR,
|
PATH_SEPARATOR,
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -46,46 +46,49 @@ else {
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
<!-- includes of neccessary libs -->
|
<!-- includes of necessary libs -->
|
||||||
<?php readfile('./shared/imports.php'); ?>
|
<?php readfile('./shared/imports.php'); ?>
|
||||||
|
|
||||||
<title>cwsvJudo Online Apps</title>
|
<title>cwsvJudo Online Apps</title>
|
||||||
<meta name="description" content="Loginseite der Online-Apps der Judoka des CWSV">
|
<meta name="description" content="Login-Seite der Online-Apps der Judoka des CWSV">
|
||||||
</head>
|
</head>
|
||||||
<body class="container">
|
|
||||||
<h1>Loginseite der Online-Apps der Judoka des CWSV</h1>
|
<body>
|
||||||
|
<h1>Login-Seite der Online-Apps der Judoka des CWSV</h1>
|
||||||
|
|
||||||
<?php echo(htmlRetMessage(participo::getMessages())); ?>
|
<?php echo(htmlRetMessage(participo::getMessages())); ?>
|
||||||
<form action="./login.php" method="post">
|
|
||||||
<fieldset>
|
<div class="container">
|
||||||
<legend>Benutzerdaten</legend>
|
<div class="row">
|
||||||
<div>
|
<div class="col s6 offset-s3 z-depth-1">
|
||||||
<label for="username">Benutzername</label>
|
<h2 id="title">Benutzerdaten</h2>
|
||||||
|
|
||||||
|
<form id="loginForm" action="./login.php" method="post">
|
||||||
|
<div class="input-field">
|
||||||
<input id="username" type="text" name="f[username]" <?php echo isset($_POST['f']['username']) ? ' value="' . htmlspecialchars($_POST['f']['username']) . '"' : '' ?> />
|
<input id="username" type="text" name="f[username]" <?php echo isset($_POST['f']['username']) ? ' value="' . htmlspecialchars($_POST['f']['username']) . '"' : '' ?> />
|
||||||
|
<label for="username">Benutzername</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="input-field">
|
||||||
<label for="password">Kennnwort</label>
|
|
||||||
<input id="password" type="password" name="f[password]" />
|
<input id="password" type="password" name="f[password]" />
|
||||||
|
<label for="password">Kennwort</label>
|
||||||
</div>
|
</div>
|
||||||
<?php if (isset($_GET['returnToUrl'])) {
|
<?php # If a return url was given, add it as input to the form
|
||||||
|
if (isset($_GET['returnToUrl'])) {
|
||||||
echo('<input type="hidden" name="returnToUrl" value="' . htmlspecialchars($_GET['returnToUrl']) . '" />');
|
echo('<input type="hidden" name="returnToUrl" value="' . htmlspecialchars($_GET['returnToUrl']) . '" />');
|
||||||
} ?>
|
}
|
||||||
<?php if (isset($_POST['returnToUrl'])) {
|
?>
|
||||||
echo('<input type="hidden" name="returnToUrl" value="' . htmlspecialchars($_POST['returnToUrl']) . '" />');
|
|
||||||
} ?>
|
|
||||||
<input id="fragment" type="hidden" name="fragment" />
|
<input id="fragment" type="hidden" name="fragment" />
|
||||||
<!-- add the fragment to the post data-->
|
<!-- add the fragment (stuff behind the # in the url) to the post data -->
|
||||||
<script>
|
<script>
|
||||||
if(window.location.hash){
|
if(window.location.hash){
|
||||||
document.getElementById("fragment").value=window.location.hash;
|
document.getElementById("fragment").value=window.location.hash;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<!-- <p>
|
||||||
</fieldset>
|
<input type="checkbox" id="remember"/>
|
||||||
<fieldset>
|
<label for="remember" id="checkbox" >Remember me</label>
|
||||||
<div>
|
</p> -->
|
||||||
<input type="submit" name="submit" value="Anmelden" />
|
<input type="submit" name="submit" value="Anmelden" class="waves-effect waves-light btn" id="submitButton" />
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
<fieldset class="notice"><legend>Hinweise</legend>
|
<fieldset class="notice"><legend>Hinweise</legend>
|
||||||
<ul style="padding-left: inherit;">
|
<ul style="padding-left: inherit;">
|
||||||
<li style="list-style-type: circle;" >Logindaten sollten vom Übungsleiter vergeben worden sein.</li>
|
<li style="list-style-type: circle;" >Logindaten sollten vom Übungsleiter vergeben worden sein.</li>
|
||||||
@@ -94,5 +97,9 @@ else {
|
|||||||
</ul>
|
</ul>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
if (ini_get('session.use_cookies')) {
|
if (ini_get('session.use_cookies')) {
|
||||||
$params = session_get_cookie_params();
|
$params = session_get_cookie_params();
|
||||||
setcookie(
|
setcookie(
|
||||||
session_name(),
|
$name=session_name(),
|
||||||
'',
|
'',
|
||||||
time() - 42000,
|
$expires=(time() - 42000),
|
||||||
$params['path'],
|
$path=$params['path'] ?? "",
|
||||||
$params['domain'],
|
$domain=$params['domain'] ?? "",
|
||||||
$params['secure"'],
|
$params['secure"'] ?? false,
|
||||||
$params['httponly']
|
$params['httponly'] ?? false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
session_destroy();
|
session_destroy();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class TestParticipo(unittest.TestCase):
|
|||||||
participo.login()
|
participo.login()
|
||||||
self.assertTrue(participo.check_login())
|
self.assertTrue(participo.check_login())
|
||||||
|
|
||||||
sections = ("events", "infoZettel", "attendance", "user")
|
sections = ("events", "infoZettel", "attendance", "user", "logout")
|
||||||
for section in sections:
|
for section in sections:
|
||||||
with self.subTest(msg=f"- {section}"):
|
with self.subTest(msg=f"- {section}"):
|
||||||
participo.load_section(section=section)
|
participo.load_section(section=section)
|
||||||
|
|||||||
Reference in New Issue
Block a user