Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 32 lines (26 sloc) 0.9 kb
2b64c6d @sj26 Make all controllers inherit from a single DeviseController
sj26 authored
1 class Devise::UnlocksController < DeviseController
a5ba2ac @carlosantoniodasilva Use prepend_before_filter in require_no_authentication.
carlosantoniodasilva authored
2 prepend_before_filter :require_no_authentication
8a15ac6 @josevalim Stub out other views for Registerable.
josevalim authored
3
4 # GET /resource/unlock/new
5 def new
0aa41d6 @josevalim Tidy up lose ends.
josevalim authored
6 build_resource({})
8a15ac6 @josevalim Stub out other views for Registerable.
josevalim authored
7 end
8
9 # POST /resource/unlock
10 def create
11 self.resource = resource_class.send_unlock_instructions(params[resource_name])
12
2a5ad46 @josevalim Change all paranoid settings to behave as success instead of as failure,...
josevalim authored
13 if successfully_sent?(resource)
308238a Not responding the object on creating unlockable requests
Rodrigo Flores authored
14 respond_with({}, :location => new_session_path(resource_name))
40c0a7b Added paranoid mode to lockable
Rodrigo Flores authored
15 else
66b93e8 @josevalim Clean up as we don't need to call render_with_scope anymore.
josevalim authored
16 respond_with(resource)
8a15ac6 @josevalim Stub out other views for Registerable.
josevalim authored
17 end
18 end
d2fa737 @mhfs introducing lockable implementation
mhfs authored
19
20 # GET /resource/unlock?unlock_token=abcdef
21 def show
ac742e3 @josevalim Clean up lockable and class methods API.
josevalim authored
22 self.resource = resource_class.unlock_access_by_token(params[:unlock_token])
d2fa737 @mhfs introducing lockable implementation
mhfs authored
23
24 if resource.errors.empty?
210bc6a @sikachu Add support for non-navigational formats in UnlocksController
sikachu authored
25 set_flash_message :notice, :unlocked if is_navigational_format?
1e1e964 @nashby redirect users to sign in page after unlock, closes #1486
nashby authored
26 respond_with_navigational(resource){ redirect_to new_session_path(resource) }
d2fa737 @mhfs introducing lockable implementation
mhfs authored
27 else
d9df632 @josevalim Get rid of InternalHelpers, refactor scoped views for more performant be...
josevalim authored
28 respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render :new }
d2fa737 @mhfs introducing lockable implementation
mhfs authored
29 end
30 end
31 end
Something went wrong with that request. Please try again.