Skip to content

Added possibility for disabling login with password #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,26 @@ In order to use the remote shutdown functionality you have to give the user `www
[...]
```

#### Disabling password login

If your RaspberryPi is on a private part of the network and you don't want to use a password, you can disable it.
To do this, in the `local.config` file, set the `loginWithPassword` parameter to `0`.
If there is no `loginWithPassword` parameter in your `local.config` file, simply add it after the `pass` option.

Example:
```
[...]
'general' =>
array (
[...]
'pass' => 'YOUR_MD5_PASSPHRASE_HERE',
'loginWithPassword' => '0',
[...]
),
[...]
```

4. Remember password and enjoy!
> **As always**: Make sure to change the default password (which is **root**) and choose a more secure one at first setup and consider more security if your dashboard is accessible on the network.

## License
Expand Down
1 change: 1 addition & 0 deletions defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
'general' =>
array (
'pass' => '63a9f0ea7bb98050796b649e85481845',
'loginWithPassword' => '1',
'initialsetup' => '0',
'tempunit' => '0'
),
Expand Down
16 changes: 15 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@
$config = new Config;
$config->load("local.config", "defaults.php");

$auth=(isset($_SESSION["rpidbauth"])) ? true : false;
$loginWithPassword = $config->get("general.loginWithPassword");

if($loginWithPassword) {
$auth = (isset($_SESSION["rpidbauth"])) ? true : false;
}
else {
$auth = true;
$_SESSION["rpidbauth"]=time();
}

if(!isset($_SESSION["setup"])){
if( ($config->get("general.initialsetup")=="0") || ($config->get("general.initialsetup")=="") ){
Expand Down Expand Up @@ -189,7 +197,11 @@
<div class="card-header border-primary text-primary"><i class="bi bi-command"></i>&nbsp;System</div>
<div class="card-body">
<button type="button" data-bs-toggle="modal" data-bs-target="#exampleModalCenter" class="btn btn-outline-primary mt-1"><i class="bi bi-power"></i>&nbsp;Power</button>&nbsp;
<?php
if($loginWithPassword) {
?>
<button type="button" onclick="logout()" class="btn btn-outline-warning mt-1"><i class="bi bi-arrow-right-square"></i>&nbsp;Logout</button>
<?php } ?>
</div>
</div>
</div>
Expand Down Expand Up @@ -586,6 +598,8 @@
<script src="js/radialIndicator-2.0.0.min.js"></script>

<script>
const authVar = <?=$loginWithPassword?>;
const authEnabled = (authVar.toString() === "1");
warn_cpu_temp = <?=$config->get("thresholds.warn_cpu_temp")?>;
warn_ram_space = <?=$config->get("thresholds.warn_ram_space")?>;
upd_time_interval = <?=$config->get("thresholds.upd_time_interval")?>;
Expand Down
2 changes: 1 addition & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ function updatedb(){
console.log("Live : Updating...");
$('#overallstate').html('<font class="text-muted"><i class="bi bi-hourglass-split"></i>&nbsp;Updating ...</font>');
document.getElementById("sys11").innerHTML="";
if(result.auth=="false"){
if(authEnabled && result.auth=="false"){
if(timer==true){
clearInterval(updinterval);
timer=false;
Expand Down