[Catalyst] Legacy porting to auto-authenticate a logged in user
I have what I first thought was a gimme (this is only tangentially related to the questions I asked a few days ago; same app, different DB and part). Legacy porting of a login with Authenticate where I already have the user id and everything verified. I have tried many permutations of arguments and setup. The user has already logged into the legacy part of the app. So this is the code that is not working but I think should. my $user_id = ...legacy fetch; working fine my $user = $c-model(DB::User)-find($user_id) or die RC_403: No such user for id $user_id; # also working fine # this dies, I've verified the $user, username, and password are correct $c-authenticate({ username = $user-username, password = $user-password }) or die RC_403: . $user-username . failed to authenticate; So… why? The legacy setup is a little strange so I think that must be it. The user table's DBIC looks like this (password is plaintext, legacy, and crypt_passwd is sha1 of it)- package MyApp::DB::User; use base qw/DBIx::Class/; __PACKAGE__-load_components(qw/PK::Auto Core/); __PACKAGE__-table('foo.account'); __PACKAGE__-add_columns(qw/ acctid email fname lname password crypt_passwd /); __PACKAGE__-set_primary_key('acctid'); sub username { +shift-email; }; My config looks like this- authentication: default_realm: users realms: users: credential: class: Password password_field: crypt_passwd password_type: hashed password_hash_type: SHA-1 store: class: DBIx::Class user_class: DB::User id_field: acctid Thanks for looking! -Ashley ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
RE: [Catalyst] Legacy porting to auto-authenticate a logged in user
Try $c-authenticate({ acctid = $user-username, password = $user-password }) or die RC_403: . $user-username . failed to authenticate; Regards, Peter -Original Message- From: Ashley Pond V [mailto:[EMAIL PROTECTED] Sent: 22 December 2007 08:08 To: The elegant MVC web framework Subject: [Catalyst] Legacy porting to auto-authenticate a logged in user I have what I first thought was a gimme (this is only tangentially related to the questions I asked a few days ago; same app, different DB and part). Legacy porting of a login with Authenticate where I already have the user id and everything verified. I have tried many permutations of arguments and setup. The user has already logged into the legacy part of the app. So this is the code that is not working but I think should. my $user_id = ...legacy fetch; working fine my $user = $c-model(DB::User)-find($user_id) or die RC_403: No such user for id $user_id; # also working fine # this dies, I've verified the $user, username, and password are correct $c-authenticate({ username = $user-username, password = $user-password }) or die RC_403: . $user-username . failed to authenticate; So. why? The legacy setup is a little strange so I think that must be it. The user table's DBIC looks like this (password is plaintext, legacy, and crypt_passwd is sha1 of it)- package MyApp::DB::User; use base qw/DBIx::Class/; __PACKAGE__-load_components(qw/PK::Auto Core/); __PACKAGE__-table('foo.account'); __PACKAGE__-add_columns(qw/ acctid email fname lname password crypt_passwd /); __PACKAGE__-set_primary_key('acctid'); sub username { +shift-email; }; My config looks like this- authentication: default_realm: users realms: users: credential: class: Password password_field: crypt_passwd password_type: hashed password_hash_type: SHA-1 store: class: DBIx::Class user_class: DB::User id_field: acctid Thanks for looking! -Ashley ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: javascript in Catalyst using Template Toolkit
On 23 Dec 2007, at 01:06, kevin montuori wrote: obCatalyst: let me add that if you use emacs :| you could define a little function like: (defun ii-insert-catalyst-url () (interactive) (let ((path (read-from-minibuffer URI: ))) (insert (format a href=\[%% Catalyst.uri_for('%s') %%]\/ a path)) (backward-char 4))) to do the work for you. if you're accustomed to using html-mode or sgml-mode you might even rebind C-c C-c h (html-href-anchor): (add-hook 'html-mode-hook well tt-mode would be more sensible. Some people ought to be able to write a little vi macro to do this too. I suspect that the macro would be written in perl. Also most of the time we'duse c.uri_for not Catalyst.uri_for '(lambda () (define-key html-mode-map \C-c\C-c\h 'ii-insert-catalyst-url))) and there'd be no new finger memory to develop, so no extra work whatsoever. This is axiomatic. Software sucks. You can a contribution to how much your software sucks by taking that little bit of extra effort and making the little bit of software that you're responsible for suck less. Because if software sucks, good software sucks less. HTH ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Re: javascript in Catalyst using Template Toolkit
KD == Kieren Diment [EMAIL PROTECTED] writes: KD On 23 Dec 2007, at 01:06, kevin montuori wrote: (add-hook 'html-mode-hook KD well tt-mode would be more sensible. my mileage varied. the font-locking of TT keywords would be ok but the the completion, indention, and validation sgml-/html-mode provides is actually useful. k. -- kevin montuori ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [OT] ASP.NET MVC#
On Dec 21, 2007 10:22 PM, Daniel McBrearty [EMAIL PROTECTED] wrote: i'm not completely following the new syntax that you are proposing, so please forgive if I am wide of the mark here ... but ... IMO the existing syntax is really not *that* bad - the only mild crit I have is that Args() really means I'm an endpoint, which it doesn't say. For me, a simple improvement would be to allow an alternative name such as EndpointArgs that is a bit more obvious, and keep the rest just as it is. My argument really is that the number of parameters an action takes is independent from the fact that it is an end point or is not, and that you should not have one attribute that carries both of those meanings. So my latest proposal is to use Args to indicate the numer of parameters an action takes (just like you do it now, but also when you now use CaptureArgs) and IsParent to indicate that you can attach other actions to it. I worry a bit that two syntaxes, achieving the same thing but looking quite different to each other, and both coexisting in docs, mailing lists, and code, are just going to add more potential confusion than they clear up. Understood. If my proposal gets accepted I volunteer to purge CaptureArgs from the docs (and the Ministry of Love will go after those that mention CaptureArgs on the mailing lists). I think my proposal is really minimal - in fact I would say it does not introduce more new things than your 'simple improvement' above. Cheers, Zbigniew Lukasiak http://perlalchemy.blogspot.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/