Did you 
see https://groups.google.com/d/topic/google-web-toolkit/KyzgtqqoJGE/discussion 
? 
(and 
https://groups.google.com/d/topic/google-web-toolkit/fNN5g5D7TFY/discussion)
I'm not sure it still works in modern browsers though.

If you can use a "proper" (i.e. non-GWT, non-ajax) form for login, do it.
If your app requires the user to be logged in, then just make it impossible 
to load the host page without being authenticated, redirecting to a login 
form (and instead of managing your own user/password database and risk 
password leaks, delegate auth to Google+ and/or Facebook and/or LinkedIn). 
Otherwise, simply redirect to the login page (unload the app) and back to 
the app after sign-in (load the app again).
This is the easiest; you can see it in use for GMail (requires login) and 
Google Groups.

If you can't "break the flow" with a redirect to a login page, then run it 
in an iframe or popup. IIRC, an earlier version of Google Analytics used an 
iframe with the form for an ajax-y UX, communicating with the outer window 
when it's OK to redirect to the proper app. And Google+ Sign In uses a 
popup.
It's much more complicated than a simple redirect though (not only how to 
login, but also all it implies for your app switching dynamically from 
anonymous to logged-in user).

On Wednesday, June 4, 2014 1:12:51 AM UTC+2, Blake wrote:
>
> Greetings,
>
> I would like to have the browser save the username/password to my 
> application.  I have searched and searched and found no solution that works 
> on all of the standard browsers (Chrome, IE, Firefox, Safari).  Best I have 
> been able to do (works on Firefox & IE) is:
>
>
> ....
> <form id="login-form" action="login">
>     <table>
>         <tr>
>             <td><button type=“button”>Continue as a guest</button> 
> &nbsp;&nbsp;or &nbsp;&nbsp;Login ID:</td>
>             <td> <input autocomplete="on" type="text" tabindex="0" 
> name="username" id="username" placeholder=Email&nbsp;Address></td>
>             <td>(email address)</td>
>         </tr>
>         <tr>
>             <td align=right>Password:</td>
>             <td><input autocomplete="on" type="password" tabindex="0" 
> name="password" id="password" placeholder=Password></td>
>             <td><button type=“submit”>Login</button></td>
>         </tr>
>     </table>
> </form>
> ....
>
>
>     private static final String FORM_ID = "login-form";
>     private static final String USER_ID = "username";
>     private static final String PASSWORD_ID = "password";
>
>     
>    private static void doLogin() {
>         Window.alert("test 1");
>     }
>
>     private static native void injectLoginFunction() /*-{
>         $wnd.login = function() {
>             @booklion.client.login.Login::doLogin()();
>         };
>     }-*/;
>
>
>     public void onModuleLoad() {
>         injectLoginFunction();  // ok
>         TextBox fUsername = TextBox.wrap(DOM.getElementById(USER_ID));
>         fUsername.setStyleName("gwt-TextBox");
>         PasswordTextBox fPassword = 
> PasswordTextBox.wrap(DOM.getElementById(PASSWORD_ID));
>         fPassword.setStyleName("gwt-PasswordTextBox");
>         FormPanel fLoginForm = FormPanel.wrap(DOM.getElementById(FORM_ID), 
> false); 
>         fLoginForm.setAction("");  //  ok
>         fLoginForm.addSubmitHandler(new FormPanel.SubmitHandler() { 
>
>             @Override
>             public void onSubmit(FormPanel.SubmitEvent event) {
>                 Window.alert("test 2");
>             }
>         });
>         fLoginForm.getElement().setAttribute("onsubmit", "login();return 
> false;");
>     }
>
>
> test 1 gets displayed - not test 2.  Firefox and IE offer to save the 
> password.  Chrome and Safari do not.
>
> Sure would appreciate some help.
>
> Thanks.
>
> Blake McBride
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to