Skip to content

Commit

Permalink
Updated Home page, Password will be random generated on each Admin Lo…
Browse files Browse the repository at this point in the history
…gin if admin forgot to set it and small visual bugs
  • Loading branch information
zigazajc007 committed Jan 31, 2023
1 parent 7b2bf38 commit 80aeddd
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![GitHub forks](https://img.shields.io/github/forks/Rabbit-Company/Passky-Server?style=for-the-badge)](https://github.com/Rabbit-Company/Passky-Server/network)
[![GitHub license](https://img.shields.io/github/license/Rabbit-Company/Passky-Server?color=blue&style=for-the-badge)](https://github.com/Rabbit-Company/Passky-Server/blob/main/LICENSE)

### [Download from Rabbit Store](https://rabbitstore.org/?app=com.rabbit-company.passky)
### [Download from Official Website](https://passky.org/download)

## Passky Clients

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "passky-server",
"description": "Server for Passky (password manager)",
"version": "8.1.0",
"version": "8.1.1",
"main": "tailwind.config.js",
"scripts": {
"build": "npx tailwindcss -i ./tailwind.css -o ./server/src/website/css/tailwind.min.css --minify"
Expand Down
16 changes: 16 additions & 0 deletions server/docker/etc/s6-overlay/scripts/runas-user
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ echo '
-------------------------------------------------------------------
'

if [[ -z $DATABASE_ENGINE ]]; then
DATABASE_ENGINE=sqlite
fi

if [[ -z $ACCOUNT_MAX ]]; then
ACCOUNT_MAX=100
fi

if [[ -z $ACCOUNT_MAX_PASSWORDS ]]; then
ACCOUNT_MAX_PASSWORDS=1000
fi

if [[ -z $ACCOUNT_PREMIUM ]]; then
ACCOUNT_PREMIUM=-1
fi

echo '
--------------------------------------------
Settings
Expand Down
10 changes: 5 additions & 5 deletions server/src/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Settings{
*/

public static function getVersion() : string{
return '8.1.0';
return '8.1.1';
}

public static function getLocation() : string{
Expand All @@ -43,7 +43,7 @@ public static function getAdminUsername() : string{
}

public static function getAdminPassword() : string{
return getenv('ADMIN_PASSWORD', true) ?: getenv('ADMIN_PASSWORD') ?: 'fehu2UPmpragklWoJcbr4BajxoaGns';
return getenv('ADMIN_PASSWORD', true) ?: getenv('ADMIN_PASSWORD') ?: hash('sha256', 'passky' . random_int(PHP_INT_MIN, PHP_INT_MAX) . random_int(PHP_INT_MIN, PHP_INT_MAX));
}

public static function getCFTSiteKey() : string{
Expand Down Expand Up @@ -165,7 +165,7 @@ public static function getRedisLocalPassword() : string{
*/

public static function getMail() : bool{
return in_array(getenv('MAIL_ENABLED', true), ['true', '1'], true);

This comment has been minimized.

Copy link
@vzool

vzool Feb 1, 2023

Member

I think you have to revert that, because getenv in shared hosting returns "1" instead of "true".

This comment has been minimized.

Copy link
@zigazajc007

zigazajc007 Feb 1, 2023

Author Member

1 in string format or integer?

This comment has been minimized.

Copy link
@vzool

vzool Feb 1, 2023

Member

Both are pure strings 🤣

This comment has been minimized.

Copy link
@vzool

vzool Feb 1, 2023

Member

To verify use var_dump function 🤗

This comment has been minimized.

Copy link
@zigazajc007

zigazajc007 Feb 1, 2023

Author Member

I made a test before the release and it wasn't working. It could be that I made a poor test or that PHP does not support ['true', '1'] arrays, but it needs array('true', '1').

So we can use it like this:

	public static function getMail() : bool{
		$enabled = getenv('MAIL_ENABLED', true) ?: getenv('MAIL_ENABLED') ?: 'false';
		return in_array($enabled, array('true', '1'), true);
	}

This way we can also specify the default value.

This comment has been minimized.

Copy link
@vzool

vzool Feb 1, 2023

Member

I'm not sure about this, In fact, I prefer this one:

public static function getMail() : bool{
    return in_array(getenv('MAIL_ENABLED', true), array('true', '1'), true);
}

This comment has been minimized.

Copy link
@vzool

vzool Feb 1, 2023

Member

I made a test before the release and it wasn't working. It could be that I made a poor test or that PHP does not support ['true', '1'] arrays, but it needs array('true', '1').

So we can use it like this:

	public static function getMail() : bool{
		$enabled = getenv('MAIL_ENABLED', true) ?: getenv('MAIL_ENABLED') ?: 'false';
		return in_array($enabled, array('true', '1'), true);
	}

This way we can also specify the default value.

But, if you are sure that it is working on docker and on shared hosting (like php -S localhost:8080) go ahead. 🤗

This comment has been minimized.

Copy link
@zigazajc007

zigazajc007 Feb 1, 2023

Author Member

With docker it seems to work with 'true' and 'false', but it doesn't work if you set the env variable to 0.

return getenv('MAIL_ENABLED', true) === 'true';
}

public static function getMailHost() : string{
Expand All @@ -185,7 +185,7 @@ public static function getMailPassword() : string{
}

public static function getMailTLS() : bool{
return in_array(getenv('MAIL_USE_TLS', true), ['true', '1'], true);
return getenv('MAIL_USE_TLS', true) === 'true';
}

/*
Expand Down Expand Up @@ -227,7 +227,7 @@ public static function getYubiId() : int{
*/

public static function getLimiter() : bool{
return in_array(getenv('LIMITER_ENABLED', true), ['true', '1'], true);
return getenv('LIMITER_ENABLED', true) === 'true';
}

public static function getLimiterGetInfo() : int{
Expand Down
8 changes: 4 additions & 4 deletions server/src/website/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<section id="home">
<div class="max-w-7xl mx-auto py-12 px-4 sm:py-16 sm:px-6 lg:px-8">
<h2 class="mb-6 text-3xl font-extrabold tertiaryColor sm:text-4xl">Passky Server</h2>
<p class="text-base secondaryColor">If you see this page, that means your <a href="https://github.com/Rabbit-Company/Passky-Server" target="_blank" class="primaryColor">Passky Server</a> has been successfully installed.</p>
<p class="text-base secondaryColor">The successful installation of the <a href="https://github.com/Rabbit-Company/Passky-Server" target="_blank" class="primaryColor">Passky Server</a> is indicated by the appearance of this page.</p>
<h3 class="mb-6 mt-12 text-2xl font-extrabold tertiaryColor sm:text-3xl">How do I use it?</h3>
<p class="text-base mt-2 tertiaryColor">1. Download Passky Client</p>
<p class="text-base secondaryColor">Passky Client can be accessed right from the <a href="https://vault.passky.org" target="_blank" class="primaryColor">Website</a> or it can be downloaded from <a href="https://rabbitstore.org/?app=com.rabbit-company.passky" target="_blank" class="primaryColor">Rabbit Store</a>.</p>
<p class="text-base secondaryColor">The Passky Client can be obtained from the <a href="https://passky.org/download" target="_blank" class="primaryColor">Official Website</a> or accessed directly through the <a href="https://vault.passky.org" target="_blank" class="primaryColor">https://vault.passky.org</a> portal.</p>
<p class="text-base mt-2 tertiaryColor">2. Connect to your Passky Server</p>
<p class="text-base secondaryColor">When you open Passky Client, you will see the first field called "Server". In this field enter URL of your Passky Server: <b class="primaryColor" id="server-origin"></b></p>
<p class="text-base secondaryColor">Upon opening the Passky Client, you will encounter the first field labeled "Server". In this field, please enter the URL of your Passky Server: <b class="primaryColor" id="server-origin"></b></p>
<p class="text-base mt-2 tertiaryColor">3. Sign in or Sign up</p>
<p class="text-base secondaryColor">Now you can fill rest of the fields and click on "Sign in" or "Sign up" button.</p>
<p class="text-base secondaryColor">You may now complete the remaining fields and proceed by clicking on either the "Sign In" or "Sign Up" button.</p>
</div>
</section>

Expand Down

0 comments on commit 80aeddd

Please sign in to comment.