joscha / play-authenticate

An authentication plugin for Play Framework 2.x (Java)
http://joscha.github.com/play-authenticate/
Other
807 stars 367 forks source link

return Result in JSON from signup or login #353

Closed leccyril closed 6 years ago

leccyril commented 6 years ago

hi i have this method and if there is an error it works but if success i stay on the signup page and the alert show "play.mvc.result object" i would return a template or message in json

`public Result doSignup(String role) { com.feth.play.module.pa.controllers.Authenticate.noCache(response());

    ResponseJson response = new ResponseJson();

    final Form<MySignup> filledForm = this.provider.getSignupForm().bindFromRequest();
    if (filledForm.hasErrors()) {
        response.setError(_signupForm.render(filledForm).toString());
    } else {
        // Everything was filled
        // do something with your part of the form before handling the user
        // signup
        response.setSuccess(this.provider.handleSignup(ctx()).toString());
    }

    return ok().sendJson(Json.toJson(response));`

i don't know how to do , i use the librairie not the source, have you an idea?

leccyril commented 6 years ago

i check the header redirection... but if there is an exception i have a doubt on what is made...