Fixes in password hash for avoid limit character bugs in bcrypt
This commit is contained in:
parent
2d6f6da098
commit
46b18e0dde
3 changed files with 6 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
|||
${show_flash_message()|n}
|
||||
<h1>${admin.title}</h1>
|
||||
<a href="${add_get_parameters(admin.url, op_admin='1')}">${lang('common', 'add_item', 'Add new item')}</a>
|
||||
${admin.list.show()|n}
|
||||
${admin.list.show()|n}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
from paramecio.cromosoma.corefields import PhangoField
|
||||
from paramecio.cromosoma.coreforms import PasswordForm
|
||||
from passlib.hash import bcrypt
|
||||
#from passlib.hash import bcrypt
|
||||
from passlib.hash import bcrypt_sha256
|
||||
|
||||
class PasswordField(PhangoField):
|
||||
|
||||
|
|
@ -36,7 +37,7 @@ class PasswordField(PhangoField):
|
|||
self.error=True
|
||||
|
||||
else:
|
||||
value = bcrypt.encrypt(value)
|
||||
value = bcrypt_sha256.encrypt(value)
|
||||
|
||||
|
||||
return value
|
||||
|
|
@ -44,6 +45,6 @@ class PasswordField(PhangoField):
|
|||
@staticmethod
|
||||
def verify( password, h):
|
||||
|
||||
return bcrypt.verify(password, h)
|
||||
return bcrypt_sha256.verify(password, h)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
url: "${make_url('admin/register')}",
|
||||
method: "POST",
|
||||
dataType: "json",
|
||||
data: {'username': $('#username_form').val(), 'email': $('#email_form').val(), 'password': $('#password_form').val(), 'repeat_password': $('#repeat_password_form').val()}
|
||||
data: {'username': $('#username_form').val(), 'email': $('#email_form').val(), 'password': $('#password_form').val(), 'repeat_password': $('#repeat_password_form').val(), 'csrf_token': $('#csrf_token').val()}
|
||||
}).done(function(data) {
|
||||
//$( this ).addClass( "done" );
|
||||
//Redirect if register
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue