SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 388 | Next

Ola Bini

"Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to Java"

If you get data back, you??™ll create a new Borrower for it, and also add all
the information about that person??™s already borrowed books to the database. Finally the data
is saved. Note that this code doesn??™t check for clashes against current users, so if you??™re
unlucky, this Borrower can??™t import his or her account because he or she has the same username
as someone already existing in this library.
The final login code is almost exactly the same as in llogin. You don??™t have to handle the
case of an imported Borrower any differently, for the simple reason that you just save his or her
data to the database, and the authentication lookups will find him or her. Of course, this also
works for already existing users doing a regular login.
The view for blogin looks like Listing 14-6.
Listing 14-6. app/views/auth/blogin.rhtml

Please login with your username and password


<%= start_form_tag %>
<%= hidden_field_tag 'into', @into %>














CHAPTER 14 ?–  THE LIBLIB RAILS APPLICATION 270
I have an account at another library (importing will
take a few seconds):
<%= check_box_tag 'other_library' %>
Username:<%= text_field_tag 'username' %>
Password:<%= password_field_tag 'password' %>
<%= submit_tag 'Login' %>

<%= end_form_tag %>
<%= link_to "I don't have a borrowers account",
:controller => 'borrower', :action => 'new', :into => @into %>
This view provides the check box for other_library, and also adds a link to create a new
Borrower account, if needed.


Pages:
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400