about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/la/lanraragi/expose-password-hashing.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/by-name/la/lanraragi/expose-password-hashing.patch')
-rw-r--r--nixpkgs/pkgs/by-name/la/lanraragi/expose-password-hashing.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/by-name/la/lanraragi/expose-password-hashing.patch b/nixpkgs/pkgs/by-name/la/lanraragi/expose-password-hashing.patch
new file mode 100644
index 000000000000..1f6941f55ff4
--- /dev/null
+++ b/nixpkgs/pkgs/by-name/la/lanraragi/expose-password-hashing.patch
@@ -0,0 +1,36 @@
+diff --git a/lib/LANraragi/Controller/Config.pm b/lib/LANraragi/Controller/Config.pm
+index 2cd2c999..0bd8ab6e 100644
+--- a/lib/LANraragi/Controller/Config.pm
++++ b/lib/LANraragi/Controller/Config.pm
+@@ -50,6 +50,15 @@ sub index {
+     );
+ }
+ 
++sub make_password_hash {
++    my $ppr = Authen::Passphrase::BlowfishCrypt->new(
++        cost        => 8,
++        salt_random => 1,
++        passphrase  => shift,
++    );
++    return $ppr->as_rfc2307;
++}
++
+ # Save the given parameters to the Redis config
+ sub save_config {
+ 
+@@ -95,14 +104,7 @@ sub save_config {
+         my $password = $self->req->param('newpassword');
+ 
+         if ( $password ne "" ) {
+-            my $ppr = Authen::Passphrase::BlowfishCrypt->new(
+-                cost        => 8,
+-                salt_random => 1,
+-                passphrase  => $password,
+-            );
+-
+-            my $pass_hashed = $ppr->as_rfc2307;
+-            $confhash{password} = $pass_hashed;
++            $confhash{password} = make_password_hash($password);
+         }
+     }
+