wardencommunity/sinatra_warden

default :auth_success_path does not work

Closed this issue · 5 comments

Default :auth_success_path, lambda { back } specified in http://github.com/jsmestad/sinatra_warden/blob/master/lib/sinatra_warden/sinatra.rb#L42 does not work correctly bailing out with NameError: undefined local variable or method `back' for Sinatra::Application:Class

Unit tests do not catch this issue because :auth_success_path is redefined in them.

It defines instance method, not class method doesn't it?
Meanwhile, according to error message, 'back' from lambda refers to class method.

Alright, ill pull in the change from your branch.

Anyway, this seem to work correctly only with embedded login page and didn't work correctly with separate one

Here is it:
GET /protected —> GET /login —> POST /login — [back] —> GET /login

So we should go two requests back to get to the protected resource which initiated login process.

It seems that if we are to go back to protected page after logging in we should somehow save the location we came from — in session may be, or in URI string.