Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 36 lines (30 sloc) 1.162 kB
02e8c04 @josevalim Update views generator and now have scoped views.
josevalim authored
1 class Devise::UnlocksController < ApplicationController
a5ba2ac @carlosantoniodasilva Use prepend_before_filter in require_no_authentication.
carlosantoniodasilva authored
2 prepend_before_filter :require_no_authentication
b581f86 @josevalim DRY up controllers.
josevalim authored
3 include Devise::Controllers::InternalHelpers
8a15ac6 @josevalim Stub out other views for Registerable.
josevalim authored
4
5 # GET /resource/unlock/new
6 def new
0aa41d6 @josevalim Tidy up lose ends.
josevalim authored
7 build_resource({})
8a15ac6 @josevalim Stub out other views for Registerable.
josevalim authored
8 render_with_scope :new
9 end
10
11 # POST /resource/unlock
12 def create
13 self.resource = resource_class.send_unlock_instructions(params[resource_name])
14
15 if resource.errors.empty?
210bc6a @sikachu Add support for non-navigational formats in UnlocksController
sikachu authored
16 set_flash_message :notice, :send_instructions if is_navigational_format?
17 respond_with resource, :location => new_session_path(resource_name)
8a15ac6 @josevalim Stub out other views for Registerable.
josevalim authored
18 else
5b94d9b @josevalim Refactor a bit navigational format responses, to not call to_sym and …
josevalim authored
19 respond_with_navigational(resource){ render_with_scope :new }
8a15ac6 @josevalim Stub out other views for Registerable.
josevalim authored
20 end
21 end
d2fa737 @mhfs introducing lockable implementation
mhfs authored
22
23 # GET /resource/unlock?unlock_token=abcdef
24 def show
ac742e3 @josevalim Clean up lockable and class methods API.
josevalim authored
25 self.resource = resource_class.unlock_access_by_token(params[:unlock_token])
d2fa737 @mhfs introducing lockable implementation
mhfs authored
26
27 if resource.errors.empty?
210bc6a @sikachu Add support for non-navigational formats in UnlocksController
sikachu authored
28 set_flash_message :notice, :unlocked if is_navigational_format?
29 sign_in(resource_name, resource)
5b94d9b @josevalim Refactor a bit navigational format responses, to not call to_sym and …
josevalim authored
30 respond_with_navigational(resource){ redirect_to redirect_location(resource_name, resource) }
d2fa737 @mhfs introducing lockable implementation
mhfs authored
31 else
5b94d9b @josevalim Refactor a bit navigational format responses, to not call to_sym and …
josevalim authored
32 respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render_with_scope :new }
d2fa737 @mhfs introducing lockable implementation
mhfs authored
33 end
34 end
35 end
Something went wrong with that request. Please try again.