Monday, July 31st, 2006

Creating an Ajax Login Page with Dojo/Zend Framework

Category: Dojo, PHP, Programming

<>p> Alexander Netkachev shows, in this new post on his site, how to create an Ajax-based login page with the help of the Dojo library and a new offering from Zend – the Zend Framework. The Zend Framework is a MVC-based framework written in PHP.

A few days ago I understood the right usage of the framework. Frankly speaking, it does not help with creating Web forms—it has no high-level complex components like TDataGrid in PRADO or even Repeater in ASP.NET. And what I understood is that it is not Zend Framework’s business how developers are creating their forms and here is a reason for this: modern pages are created with a lot of JavaScript and, I believe, are created with client-side components, not server-side.

He set this mission before himself – to create a lightweight Ajax form combining Dojo and the Zend Framework in the easiest way possible.

He assumes you already have both libraries installed (both relatively simple to get working) and gets straight to the code. First off is the creation of the view for the login form itself, the place where the Dojo toolkit is included and the Javascript functionality lives – as well as the simple login form. Next up is the controller for the PHP side, with three actions – a default action, one to perform the login, and the other to show a success message. Finally, there’s the Dojo javascript to make the request to the backend and the PHP script to validate if the username and password are correct.

Related Content:

  • Choosing an Ajax framework
    Your customers won't have to fear Ajax if they have the right tools to work with. Help them determine which Ajax-specific framework, library or...
  • Creating a secure login page with Java
    Strong authentication and session security are the foundation of a secure Java login page. Expert Ramesh Nagappan explores the security technology and...
  • AJAX JSF Frameworks Review
    This review gives a summary on current commercial JSF Frameworks that use Ajax to update the website. The frameworks Icefaces, Netadvantage and...
  • Ajax everywhere: Which framework to choose?
    Writing and debugging Ajax, a JavaScript- and XML-driven development technique, can be difficult. In this tip, an expert introduces several frameworks...
  • Ajax everywhere: Which framework to choose?
    Writing and debugging Ajax, a JavaScript- and XML-driven development technique, can be difficult. In this tip, an expert introduces several frameworks...

Posted by Chris Cornutt at 8:14 am
6 Comments

+++--
3.7 rating from 58 votes

6 Comments »

Comments feed TrackBack URI

Maybe someone can help me with this, since I am not an expert with the Zend framework or Dojo, but does it send the username/password request over SSL? This seems like an issue to me… now I know most sites are not that important that they need a super secure login form, but using Ajax just seems to be asking for it. but then again, maybe those smart guys over at Zend have taken this into consideration. I’d love to be proven wrong on this… it would make me sleep a little better at night!

P.S. I love Ajax, so don’t get me wrong… Just not always the best technology for the job.

Comment by Ryan Lowe — July 31, 2006

PRADO has a TRepeater too. I mimics ASP.NET. Instead of PRADO it could be called PHP.NET (which isnt a knock against PRADO, I

Comment by Mario — July 31, 2006

Ryan, I believe that sending login/password over SSL is not a problem for any Ajax application. Just try to send ajax requests to https://somehost/ instead of http://.

Sincerely,
Alexander

Comment by Alexander — July 31, 2006

A very good information. Its Worth bookmarking.

Comment by Saumendra Swain — May 11, 2007

Correct me if I am wrong, but the purpose of using ajax instead of the usual form submission is the interactivity that one gets from it, meaning you don’t have to load/reload whole pages to get your credentials confirmed or rejected (“doesn’t break the surfing experience”). Also I guess that once the ajax approach has been chosen and (!) in case the data is being sent crypted over the network to the client, there’s no more need whatsoever to establish secure connections. Ryan ;-)

Here is my question… Suppose I don’t need the ajax-submission-way because I am the only person supposed to log into the site administration area and don’t mind going the old-fashioned-way but also (and more importantly) because I prefere to leave the encryption part to the system (client/server) instead of using encryption algorithms on my own in my js code. How do I secure the access (force https connections) to a subset of my zend framework resources? How do I say: if login ok -> redirect to https://example.com/protectedarea???

Comment by Yves — June 26, 2007

Nice article, here is slightly different version of creating Ajax based form using YUI instead of Dojo, the difference is, Dojo is supported by Zend Framework however the people who already have expertise in YUI or jQuery may not want to learn Dojo again (shouldn’t be a major problem but still people are short of their time these days). Here is the YUI version of Ajax based Zend form http://ciitronian.com/blog/programming/javascript/creating-ajax-based-form-zend-framework-yui/

Comment by JavaScriptProgrammer — August 17, 2010

Leave a comment

You must be logged in to post a comment.