Skip to content

Commit

Permalink
Unified Popup Login Prompt with static
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsen9026 committed Nov 26, 2019
1 parent 9a81f94 commit 030e671
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 127 deletions.
74 changes: 3 additions & 71 deletions login/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,77 +7,9 @@
<table id="container">
<tr>
<td>
<table id="loginPopupContainer">
<tr>
<th>
<?php
echo $appConfig["webAppName"];
?>
</th>
</tr>
<tr>
<td>
<div style="width:100%;text-align:center;">
<?php
if(isset($_POST['badpass'])){

?>
<script>var toast = new iqwerty.toast.Toast('Bad Username/Password');</script>
<span style="color:red;font-size:0.6em;">Bad Username/Password</span><br/>

<?php

}
if(isset($_POST['notauthorized'])){

?>
<script>var toast = new iqwerty.toast.Toast('Not Authorized');</script>
<span style="color:red;font-size:0.6em;">Not Authorized</span><br/>

<?php

}
if(isset($_SESSION)){
if(isset($timedOut)){
if($timedOut=="true"){
$timedOut="";
session_unset();
?>

<span style="color:black;font-size:0.6em;">Your session has timed out. Please log in again.</span><br/>

<?php
}
}
}

?>

Username
<input name="intent" value="<?php echo $goto;?>" hidden>
</div>
<input <?php if (!isset($_COOKIE["username"])) { ?>autofocus<?php } ?> type="text" name="username" value="<?php if (isset($_COOKIE["username"])) { echo $_COOKIE["username"];} ?>" autocomplet /><br/>
Password
<input <?php if (isset($_COOKIE["username"])) { ?>autofocus<?php } ?> type="password" name="password" value="<?php if (isset($_COOKIE["token"])) { echo json_decode($_COOKIE["token"],true)[0];} ?>" autocomplet/><br/>

<br />
<br /><div style="cursor:hand;" style="width:50%;height:3em;vertical-align:middle;display:inline">
<text onclick="checkOnPage('rememberUsernameCheckbox')">Remember Username</text>
<input id="rememberUsernameCheckbox" style="cursor:hand;width:2em;vertical-align:middle;" type="checkbox" name="rememberUsername" <?php if (isset($_COOKIE["username"])) { echo 'checked=true'; }?>/>
<?php //print_r($_COOKIE);?>
</div>
<br/>
<div style="cursor:hand;" style="width:50%;height:3em;vertical-align:middle;display:inline">
<text onclick="checkOnPage('rememberMeCheckbox')">Remember Me</text>
<input id="rememberMeCheckbox" style="cursor:hand;width:2em;vertical-align:middle;" type="checkbox" name="rememberMe" <?php if (isset($_COOKIE["token"])) { echo 'checked=true'; }?>/>
<?php //print_r($_COOKIE);?>
</div><br/>
<button type="submit">Login</button>

</td>
</tr>

</table>
<?php
include("./login/loginPrompt.php");
?>
</td>
</tr>
</table>
Expand Down
112 changes: 56 additions & 56 deletions login/loginPrompt.php
Original file line number Diff line number Diff line change
@@ -1,71 +1,71 @@
<table id="loginPopupContainer">
<tr>
<th>
<?php
echo $appConfig["webAppName"];
?>
</th>
</tr>
<tr>
<td>
<div style="width:100%;text-align:center;">
<?php
if(isset($_POST['badpass'])){

?>
<script>var toast = new iqwerty.toast.Toast('Bad Username/Password');</script>
<tr>
<th>
<?php
echo $appConfig["webAppName"];
?>
</th>
</tr>
<tr>
<td>
<div style="width:100%;text-align:center;">
<?php
if(isset($_POST['badpass'])){

?>
<script>var toast = new iqwerty.toast.Toast('Bad Username/Password');</script>
<span style="color:red;font-size:0.6em;">Bad Username/Password</span><br/>

<?php
<?php

}
?>
<span id="badPassMessage" style="display:none">Bad Username/Password</span>
<?php
if(isset($_POST['notauthorized'])){
}
if(isset($_POST['notauthorized'])){

?>
<script>var toast = new iqwerty.toast.Toast('Not Authorized');</script>
?>
<script>var toast = new iqwerty.toast.Toast('Not Authorized');</script>
<span style="color:red;font-size:0.6em;">Not Authorized</span><br/>

<?php

<?php
}
if(isset($_SESSION)){
if(isset($timedOut)){
if($timedOut=="true"){
$timedOut="";
session_unset();
?>

}
?>
<span id="notAuthorizedMessage" style="display:none">Not Authorized</span>
<?php
if(isset($_SESSION)){
if(isset($timedOut)){
if($timedOut=="true"){
$timedOut="";
session_unset();
?>
<span style="color:black;font-size:0.6em;">Your session has timed out. Please log in again.</span><br/>

<!-- <span style="color:black;">Your session has timed out. Please log in again.</span><br/>//-->
<?php
}
}
}

<?php
}
}
}
?>
?>

Username
<input name="intent" value="<?php echo $goto;?>" hidden>
</div>
<input <?php if (!isset($_COOKIE["username"])) { ?>autofocus<?php } ?> type="text" name="username" value="<?php if (isset($_COOKIE["username"])) { echo $_COOKIE["username"]; } ?>" autocomplete /><br/>
Password
<input id="passwordInput" <?php if (isset($_COOKIE["username"])) { ?>autofocus<?php } ?> type="password" name="password" autocomplete onkeypress="javascript:password_onkeypress(event);" /><br/>
Username
<input name="intent" value="<?php echo $goto;?>" hidden>
</div>
<input <?php if (!isset($_COOKIE["username"])) { ?>autofocus<?php } ?> type="text" name="username" value="<?php if (isset($_COOKIE["username"])) { echo $_COOKIE["username"];} ?>" autocomplet /><br/>
Password
<input <?php if (isset($_COOKIE["username"])) { ?>autofocus<?php } ?> type="password" name="password" value="<?php if (isset($_COOKIE["token"])) { echo json_decode($_COOKIE["token"],true)[0];} ?>" autocomplet/><br/>

<br />
<br /><div style="cursor:hand;" style="width:50%;height:3em;vertical-align:middle;display:inline">
<text onclick="checkOnPage('rememberUsernameCheckbox')">Remember Username</text>
<input id="rememberUsernameCheckbox" style="cursor:hand;width:2em;vertical-align:middle;" type="checkbox" name="rememberUsername" <?php if (isset($_COOKIE["username"])) { echo 'checked=true'; }?>/>
<?php //print_r($_COOKIE);?>
</div><br/><br/>
<button type="button" onclick="reauthenticateSession()">Login</button>
<!-- <button type="submit" hidden>Login</button>//-->
<br />
<br /><div style="cursor:hand;" style="width:50%;height:3em;vertical-align:middle;display:inline">
<text onclick="checkOnPage('rememberUsernameCheckbox')">Remember Username</text>
<input id="rememberUsernameCheckbox" style="cursor:hand;width:2em;vertical-align:middle;" type="checkbox" name="rememberUsername" <?php if (isset($_COOKIE["username"])) { echo 'checked=true'; }?>/>
<?php //print_r($_COOKIE);?>
</div>
<br/>
<div style="cursor:hand;" style="width:50%;height:3em;vertical-align:middle;display:inline">
<text onclick="checkOnPage('rememberMeCheckbox')">Remember Me</text>
<input id="rememberMeCheckbox" style="cursor:hand;width:2em;vertical-align:middle;" type="checkbox" name="rememberMe" <?php if (isset($_COOKIE["token"])) { echo 'checked=true'; }?>/>
<?php //print_r($_COOKIE);?>
</div><br/>
<button type="submit">Login</button>

</td>
</tr>
</td>
</tr>

</table>

0 comments on commit 030e671

Please sign in to comment.