LoginPanel

1 view
Skip to first unread message

rafaelt

unread,
Apr 18, 2007, 5:38:16 PM4/18/07
to GWT-Stuff
I would like know how I can validate a login??? Can you give to me a
example of validation???


[]'s

Rafael

Sandy McArthur

unread,
Apr 18, 2007, 5:44:27 PM4/18/07
to gwt-...@googlegroups.com
On 4/18/07, rafaelt <clar...@gmail.com> wrote:
> I would like know how I can validate a login??? Can you give to me a
> example of validation???

I make a RPC call in the login callback. Simplest case is to create a
RPC servlet that takes a username and password and returns a boolean
if a session was established. A more compilated service will return
error messages and maybe any initialization objects that are needed
right after login.

--
Sandy McArthur

"He who dares not offend cannot be honest."
- Thomas Paine

rafaelt

unread,
Apr 18, 2007, 5:54:51 PM4/18/07
to GWT-Stuff
Sandy do you have a example code for that???

Thanks

On 18 abr, 18:44, "Sandy McArthur" <sandy...@gmail.com> wrote:

rafaelt

unread,
Apr 18, 2007, 6:35:30 PM4/18/07
to GWT-Stuff
Another thing, how can I set the username and password to validation,
I wanna set the user and pass by database...

Sandy McArthur

unread,
Apr 18, 2007, 7:04:14 PM4/18/07
to gwt-...@googlegroups.com
class MyLoginListener extends LoginListener {
public void onSubmit(final LoginPanel loginPanel) {
final String username = loginPanel.getUserame();
final String password = loginPanel.getPassword();

final LoginServiceAsync loginService = LoginService.App.getInstance();

loginService.doLogin(username, password, new AsyncCallback() {
public void onSuccess(final Object result) {
final LoginResult loginResult = (LoginResult)result;

if (loginResult.isSuccess()) {
// Do your post login initialization
myApp.loadMainView(username);
} else {
// Login failed, try again
loginPanel.setErrorMessage(loginResult.getErrorMessage());
loginPanel.reenable();
}
}

public void onFailure(final Throwable caught) {
loginPanel.setErrorMessage(caught.getMessage());
loginPanel.reenable();
}
});
}
}

Does that help? I'm not sure what is unclear. It's just like anything
else you'd do with RPC in GWT.

I have no idea what "I wanna set the user and pass by database" means
from your other message.

On 4/18/07, rafaelt <clar...@gmail.com> wrote:
>

rafaelt

unread,
Apr 19, 2007, 3:28:05 PM4/19/07
to GWT-Stuff
I create my LoginService and still no working validation, I'm always
get the setErrorMessage.

On 18 abr, 20:04, "Sandy McArthur" <sandy...@gmail.com> wrote:
> class MyLoginListener extends LoginListener {
> public void onSubmit(final LoginPanel loginPanel) {
> final String username = loginPanel.getUserame();
> final String password = loginPanel.getPassword();
>
> final LoginServiceAsync loginService = LoginService.App.getInstance();
>
> loginService.doLogin(username, password, new AsyncCallback() {
> public void onSuccess(final Object result) {
> final LoginResult loginResult = (LoginResult)result;
>
> if (loginResult.isSuccess()) {
> // Do your post login initialization
> myApp.loadMainView(username);
> } else {
> // Login failed, try again
> loginPanel.setErrorMessage(loginResult.getErrorMessage());
> loginPanel.reenable();
> }
> }
>
> public void onFailure(final Throwable caught) {
> loginPanel.setErrorMessage(caught.getMessage());
> loginPanel.reenable();
> }
> });
> }
>
> }
>
> Does that help? I'm not sure what is unclear. It's just like anything
> else you'd do with RPC in GWT.
>
> I have no idea what "I wanna set the user and pass by database" means
> from your other message.
>

> On 4/18/07, rafaelt <clarov...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Sandy do you have a example code for that???
>
> > Thanks
>
> > On 18 abr, 18:44, "Sandy McArthur" <sandy...@gmail.com> wrote:
> > > On 4/18/07, rafaelt <clarov...@gmail.com> wrote:
>
> > > > I would like know how I can validate a login??? Can you give to me a
> > > > example of validation???
>
> > > I make a RPC call in the login callback. Simplest case is to create a
> > > RPC servlet that takes a username and password and returns a boolean
> > > if a session was established. A more compilated service will return
> > > error messages and maybe any initialization objects that are needed
> > > right after login.
>
> > > --
> > > Sandy McArthur
>
> > > "He who dares not offend cannot be honest."
> > > - Thomas Paine
>
> --
> Sandy McArthur
>
> "He who dares not offend cannot be honest."

> - Thomas Paine- Ocultar texto entre aspas -
>
> - Mostrar texto entre aspas -

Reply all
Reply to author
Forward
0 new messages