[dancer-users] Dancer::Plugin::Passphrase utf-8 mysql
Wade Burgett
wadeburgett at gmail.com
Mon Dec 31 05:29:24 GMT 2012
Hi peoples,
I am back to web-dev after a break to start a restaurant (now coding for
the restaurant instead of cooking all the time).
Anyway I believe I am having a problem revolving around utf-8 encoding
(breaking dbix internals with data going in) - maybe in the way I have the
dbic setup. I also suspect that this is something that would cause me
bigger problems in the future.
Here is the relevant parts of my config.yaml - this would be my first guess
as to the source - this is my first dancer project.
charset: "UTF-8"
# template engine
# simple: default and very basic template engine
# template_toolkit: TT
template: "simple"
session: YAML
#template: "template_toolkit"
## engines:
# template_toolkit:
# encoding: 'utf8'
# start_tag: '[%'
# end_tag: '%]'
plugins:
Auth::RBAC:
credentials:
class: SanteriaAuth
DBIC:
default:
dsn: dbi:mysql:Santeria
user: root
pass: secritpass
schema_class: My::Schema
options:
mysql_enable_utf8: 1
Database:
driver: 'mysql'
database: 'Santeria'
host: 'localhost'
port: 3306
username: 'root'
password: 'secritpass'
connection_check_threshold: 10
dbi_params:
RaiseError: 1
AutoCommit: 1
on_connect_do: ["SET NAMES 'utf8'", "SET CHARACTER SET 'utf8'" ]
log_queries: 1
Other possible problems:
I am running Ubuntu 12.04.1 LTS as my platform - so I would hope to have
necessary perl versions, mysql versions to make that work. However I will
happily dig in deeper in that area if needed.
Maybe a mysql configuration?
Any help appreciated - if you live near Portland Oregon I'll buy you a
burrito.
from here on down may not be necessary reading for someone familiar with
the utf8 issues if the stuff above is ok then maybe deeper digging is
required.
The problem came up when using Dancer::Plugin::Passphrase but I think that
this is not relevant to my real problem.
I noticed in when I ran this code
any '/makehash' => sub{
my $hash = passphrase( param('1234') )->generate_hash;
my $user = schema->resultset('SantEmployee')->find(15);
$user->pin($hash);
$user->update;
};
when I try to update the users pin, it crashes dbix internals-
Operation "eq": no method found,
left argument has no overloaded magic,
right argument in overloaded package Dancer::Plugin::Passphrase at
/usr/local/share/perl/5.14.2/DBIx/Class/Row.pm line 901, <DATA> line 16. in
/usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 98
I can quote the value of hash going into dbix like so
$user->pin($hash);
but I don't remember doing that in my pre utf-8 days of coding so I am
thinking I have mysql taking the data from perl incorrecty.
Also when I try to match the passphrase against the pin, it doesn’t match
and I really think it should.
my $user = schema->resultset('SantEmployee')->find(15);
my $pin = $user->pin;
my $result = passphrase('1234')->matches($pin);
if ($result){print $result}else{print "nomatches $pin"};
<p>nomatches {CRYPT}$2a$04$..XDNZXxKq9/zhpeu4VsbOgXSSonxsoPHX75/kN9H6nvM/oIhhYIWHTTP/1.0
200 OK
--
Wade Burgett
el hefe
Santeria
http://thesanteria.com
503-939-4719
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20121230/c1377fb5/attachment.htm>
More information about the dancer-users
mailing list