limit password length to 10000 characters

that should be sufficient…
This commit is contained in:
Daniel Friesel 2022-03-07 18:12:43 +01:00
parent e2e33de7e1
commit 13b4572a2f
No known key found for this signature in database
GPG key ID: 100D5BFB5166E005
4 changed files with 6 additions and 6 deletions

View file

@ -36,7 +36,7 @@ use XML::LibXML;
sub check_password {
my ( $password, $hash ) = @_;
if ( bcrypt( $password, $hash ) eq $hash ) {
if ( bcrypt( substr( $password, 0, 10000 ), $hash ) eq $hash ) {
return 1;
}
return 0;

View file

@ -13,7 +13,7 @@ sub hash_password {
my @salt_bytes = map { int( rand(255) ) + 1 } ( 1 .. 16 );
my $salt = en_base64( pack( 'C[16]', @salt_bytes ) );
return bcrypt( $password, '$2a$12$' . $salt );
return bcrypt( substr( $password, 0, 10000 ), '$2a$12$' . $salt );
}
sub make_token {

View file

@ -15,12 +15,12 @@
<div class="row">
<div class="input-field col l6 m12 s12">
<i class="material-icons prefix">lock</i>
%= password_field 'newpw', id => 'password', class => 'validate', required => undef, minlength => 8, autocomplete => 'new-password'
%= password_field 'newpw', id => 'password', class => 'validate', required => undef, minlength => 8, maxlength => 10000, autocomplete => 'new-password'
<label for="password">Neues Passwort</label>
</div>
<div class="input-field col l6 m12 s12">
<i class="material-icons prefix">lock</i>
%= password_field 'newpw2', id => 'password2', class => 'validate', required => undef, minlength => 8, autocomplete => 'new-password'
%= password_field 'newpw2', id => 'password2', class => 'validate', required => undef, minlength => 8, maxlength => 10000, autocomplete => 'new-password'
<label for="password2">Passwort wiederholen</label>
</div>
</div>

View file

@ -17,12 +17,12 @@
</div>
<div class="input-field col l6 m12 s12">
<i class="material-icons prefix">lock</i>
%= password_field 'password', id => 'password', class => 'validate', required => undef, minlength => 8, autocomplete => 'new-password'
%= password_field 'password', id => 'password', class => 'validate', required => undef, minlength => 8, maxlength => 10000, autocomplete => 'new-password'
<label for="password">Passwort</label>
</div>
<div class="input-field col l6 m12 s12">
<i class="material-icons prefix">lock</i>
%= password_field 'password2', id => 'password2', class => 'validate', required => undef, minlength => 8, autocomplete => 'new-password'
%= password_field 'password2', id => 'password2', class => 'validate', required => undef, minlength => 8, maxlength => 10000, autocomplete => 'new-password'
<label for="password2">Passwort wiederholen</label>
</div>
</div>