using Identity management how can i display login as a floating window

0 views
Skip to first unread message

alagappan

unread,
Dec 8, 2006, 2:31:06 AM12/8/06
to TurboGears
hi all,
i am using identity management .. but i dont the login to be a separate
page. i want it to be a floating window or a division in existing
window ..is there any way to do it...

Patrick Lewis

unread,
Dec 8, 2006, 9:03:20 AM12/8/06
to TurboGears
Without really extending identity, I don't know that you can fully get
rid of the login page. One of the underlying assuptions in the forms
based identity is that if you don't have rights to a given controller,
you are redirected to the login form (the url looks like the restricted
page, but what is displayed is the login form).

However, it is pretty easy just embed a div in any given page with a
little login form. Something like:

<div py:if="tg.identity.anonymous">
<form action="/"method="POST"> <!-- --action should be wherever you
want the user to end up-->
<table>
<tr>
<td class="label">
<label for="user_name">User Name:</label>
</td>
<td class="field">
<input type="text" id="user_name"
name="user_name"/>
</td>
</tr>
<tr>
<td class="label">
<label for="password">Password:</label>
</td>
<td class="field">
<input type="password" id="password"
name="password"/>
</td>
</tr>
<tr>
<td colspan="2" class="buttons">
<input type="submit" name="login"
value="Login"/>
</td>
</tr>
</table>
</form>
</div>

You should be able to throw that wherever you want and have it work.
Untested, of course. :-)

Floating windows and other magic stuff could be implemented in similar
ways. Just keep the three form names the same (user_name, password,
login), and you should be good to go.

Reply all
Reply to author
Forward
0 new messages