[Catalyst] Persistent login

2007-05-15 Thread Evaldas Imbrasas

I didn't find a Catalyst plugin that would transparently deal with
persistent logins. Is there one? If not, what's the recommended way to
enable persistent logins in a Catalyst-driven website?

Thanks.

--
-----
Evaldas Imbrasas
http://www.imbrasas.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: Persistent login

2007-05-15 Thread Evaldas Imbrasas

Persistent login is the one that lasts longer than a session. When a
user logs in, she gets an option to be remembered for a given period
of time. If this user comes back within that period of time, she is
auto-logged in. A good example for this is mail.yahoo.com.


On 5/15/07, A. Pagaltzis <[EMAIL PROTECTED]> wrote:

* Evaldas Imbrasas <[EMAIL PROTECTED]> [2007-05-16 00:25]:
> I didn't find a Catalyst plugin that would transparently deal
> with persistent logins. Is there one? If not, what's the
> recommended way to enable persistent logins in a
> Catalyst-driven website?

What's a persistent login?

Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/




--
-----
Evaldas Imbrasas
http://www.imbrasas.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: Persistent login

2007-05-15 Thread Evaldas Imbrasas

I do not know what you mean "lasts longer then a session"  -- http is
stateless,  if you want state (such as logged in and authorized) you need
some sort of session (cookie, uri, hiddenform,...).


I am already using standard Catalyst plugins that handle sessions and
authentication. I set sessions to expire after 1 hour of inactivity.
What I'm looking for is the ability to auto-login users when they come
back after, say, 1 week, when their previous session is long expired.

Usually, this is achieved by setting a persistent cookie (lasting for
N days) when the user logs in, and storing either user ID, username, a
random token, or a combination of all of those in an encrypted form in
that cookie. Of course, users would have to explicitly log in to
access the sensitive parts of the website.

--
---------
Evaldas Imbrasas
http://www.imbrasas.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: Persistent login

2007-05-15 Thread Evaldas Imbrasas

On 5/15/07, Jonathan Rockway <[EMAIL PROTECTED]> wrote:

Use the session plugin and set the session expiration to ... 1 week.  If some
data needs to expire sooner than that ... expire it sooner than that.

Here's what I would do.  Create a session and log the user in.  Store a "last
login" time in the user_class.  If the last_login (or last_activity;
whatever) is too long ago, delete data from the session and start over.


Yep, makes sense. However, even in that case, I was hoping that the
standard session/auth plugins would support this functionality without
doing anything additional in my Controller::Auth, i.e.:

if ($c->req->params->{login_remember}) {
 $c->login($email, $password, $expires_long);
} else {
 $c->login($email, $password, $expires_short);
}

Am I wrong in thinking that pretty much any decent login system has to
support this anyway?.. (This is my first Catalyst project, so I
wouldn't be surprised if there's a one-liner out there that would
solve this problem without a need for the above - sorry if that's the
case.)

--
---------
Evaldas Imbrasas
http://www.imbrasas.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Sending email from Catalyst and scripts

2007-05-22 Thread Evaldas Imbrasas

Hello list,

I'm looking for best practices for sending email from the catalyst app
that would also work with command-line scripts (cronjobs, one-time
scripts, etc.).

In my current setup, Email model takes care of storing metadata in the
database for each sent email, and Email controller has a private
method which takes care of generating and sending actual emails. Is
this the right way to go, or would it make more sense to move the
email sending functionality to some utility module so it works equally
well for non-catalyst scripts as well? Or is it easy enough to
setup/prepare the catalyst context in the scripts so that I could use
the send_email method from the catalyst Email controller?

What is the most common email framework setup among catalyst users? I
think it would be useful to add a few possible examples for this to
Catalyst::Manual::Cookbook as well.

Thanks.
--
-
Evaldas Imbrasas
http://www.imbrasas.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Sending email from Catalyst and scripts

2007-05-22 Thread Evaldas Imbrasas

J,

I've looked at your module, but I'm afraid it would actually make
sending emails even more dependent on catalyst, and I want to be able
to use the same email framework from both catalyst and command-line
scripts.

In my setup, each email belongs to one emailclass. Metadata for each
emailclass, including template_name, is stored in the database.
template_name defines the location for the template files for this
email class. A list of template files usually consists of templates
for text version, HTML version, email subject, and email headers (all
of them are TT templates). Each email class also has its own test
script which sends a sample email for that class.

I have two TT views - one for the text emails, and another for HTML
emails (each view has its own wrappers). As I've mentioned before,
send_email method in Controller::Email does the bulk of work: based on
the emailclass, it fetches the template files and uses the TT views to
render the parts of the email, which is then contructed using
Email::MIME::Creator (although I could have used
Catalyst::Plugin::Email as well), stores metadata for this email into
database, and then actually sends it.

So, to rephrase, my question is actually not about how to send email
from catalyst - the above setup works really well. I just want to be
able to use the same method to send emails from catalyst AND
command-line scripts. I see two ways to consider (there might be
more):

1) Somehow setup the catalyst context $c in the command-line scripts,
so I could call the same send_email method from Controller::Email. Is
this possible?

2) Move the bulk of send_email out of catalyst and just leave a
wrapper for that method in Controller::Email. The problem would be
that catalyst provides many helpful methods (i.e., easy access to
preconfigured views and models), and those wouldn't be available
outside of catalyst.


On 5/22/07, J. Shirley <[EMAIL PROTECTED]> wrote:

I've recently been working on an Email view, which I hope will become the
recommended way to send Email from Catalyst.  It hitches into Email::Send,
and also ties into your Template view (which, sadly, only works with
View::TT at the moment but I'm hoping to get the other views supported soon)

I haven't posted it to CPAN yet, as I'm waiting to get some tests written up
for it, but you can download it from the Catalyst SVN repository at:
http://dev.catalystframework.org/repos/Catalyst/trunk/Catalyst-View-Email/

I also have a tarball at
http://staff.toeat.com/~jshirley/Catalyst-View-Email-0.01.tar.gz

I recommend you read through the pod for both Catalyst::View::Email and
Catalyst::View::Email::Template

And, as for sending out an email via the command line, there are many ways
to achieve this depending upon what your goal and full use case is.

Good luck, and happy hacking,
-J


--
-----
Evaldas Imbrasas
http://www.imbrasas.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst and transactions

2007-05-25 Thread Evaldas Imbrasas

Try this:
$c->model('kRadDB')->result_source->schema

On 5/25/07, Jason Konrad <[EMAIL PROTECTED]> wrote:

This does accomplish what I was trying to do but aren't there some
connections around that I could use rather than manually connecting each
time I need to do this transaction?

$c->model('kRadDB')->schema

I get this error " Can't call method "schema" without a package or object
reference"


--
-
Evaldas Imbrasas
http://www.imbrasas.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Custom error

2007-06-25 Thread Evaldas Imbrasas

Actually, the example below doesn't work if there are any TT rendering errors.

Is there a catch-all solution, or does it have to be done on the Apache level?



http://search.cpan.org/dist/Catalyst-Manual/lib/Catalyst/Manual/Cookbook.pod#Delivering_a_Custom_Error_Page




--
-
Evaldas Imbrasas
http://www.imbrasas.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Custom error

2007-06-25 Thread Evaldas Imbrasas

Yes, that's what I meant, thanks Brian. Please provide a code example
using RenderView action. I think it would also make sense to
incorporate that example into the Catalyst cookbook instead of
existing one since that one's incomplete.


I think what Evaldas means is that an error (template not found, etc)
in the View rendering stage will not be caught by the method in the
Cookbook.

I am away from my code at the moment, but IIRC the trick is to check
$c->error AFTER you forward to MyApp::V::TT (or after the RenderView
action) and then setup your error.tt template and forward to the view
again.

If that doesn't make sense I can provide a code example later.


--
-----
Evaldas Imbrasas
http://www.imbrasas.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] New website using Catalyst

2007-08-21 Thread Evaldas Imbrasas
Hi,

I would like to annouce the launch of a new website using Catalyst
(along with DBIC and Template Toolkit):

EVO: eco-friendly products, services, and information
http://www.evo.com/

Big thanks to Catalyst developers for providing such a great framework
that made the development process so much more efficient and fun.

Please feel free to add our website to the growing list of websites
using Catalyst at http://dev.catalyst.perl.org/ .

-- 
-
Evaldas Imbrasas
http://www.imbrasas.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] New website using Catalyst

2007-08-22 Thread Evaldas Imbrasas
> This looks great.  Would you care to share any more info about the
> implementation?  Are you using FormBuilder or Imager, for example?  I
> see you're using YUI.  How did you find it?  I'm using it on a couple
> of upcoming projects.

Thanks.

We use C::P::HTML::Widget for forms. Its integration with
Catalyst/DBIC saved a great deal of time and effort, especially on the
admin part of the application. HTML::FormFu seems to be the new player
on the block, but it wasn't ready for the primetime yet when we
started developing our app. We deal with images using
C::P::Upload::Image::Magick.

I really like YUI. JQuery was my original choice for a JavaScript
framework, but I was quickly turned off by its 'hacky' nature,
disorganized docs, and plugins that were rather buggy and not well
documented. YUI is much more consistent, it has graded browser
support, and excellent docs. Also, the code written using YUI seems to
be much more maintainable, especially if you adopt the 'Module
Pattern': http://yuiblog.com/blog/2007/06/12/module-pattern/

-- 
---------
Evaldas Imbrasas
http://www.imbrasas.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] New website using Catalyst

2007-08-23 Thread Evaldas Imbrasas
> It is nice. I'm interested in how you did your "sharing" stuff. The
> "digg this," stumbled it," etc. Was it Perl-centric, CPAN, straight
> cut and paste XHTML, or something from the YUI stuff? If you can,
> please share.

Those are just straight up Javascript links, no magic involved.

> It's a very attractive site! Wonderful. What things did you use YUI for?

The frontend of the 'Green Your Tree' application is written using
YUI. It's also used for handling Ajax and DIV windows throughout the
website, as well as in the admin interface for rich text editing.

Thanks again to everyone who provided the positive feedback on and off the list.

-- 
-
Evaldas Imbrasas
http://www.imbrasas.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/