public
Description: Merb Slice for application security/authentication
Clone URL: git://github.com/technomage/secure-magic.git
Updates
technomage (author)
Mon Jun 09 21:25:09 -0700 2008
commit  37bd52b833544b378ab753e44211cebcfb561cf6
tree    d15573da990f15ad80b4cddeb6a954600030d25d
parent  9f103f0ee195636e40ed06c41c0e07f5150eb083
...
32
33
34
 
 
 
 
 
 
 
 
 
35
36
37
...
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
0
@@ -32,6 +32,15 @@ class SecureMagic::Accounts < SecureMagic::Application
0
   def authenticated?(password)
0
     crypted_password == encrypt(password)
0
   end
0
+
0
+ def current_account_name
0
+ if current_account && current_account != :false
0
+ #puts "Found current account #{current_account.inspect} login #{current_account.login}"
0
+ current_account.login
0
+ else
0
+ "Please Login"
0
+ end
0
+ end
0
 
0
   # before filter
0
   def encrypt_password
...
2
3
4
5
6
7
 
 
 
8
9
10
...
2
3
4
 
 
 
5
6
7
8
9
10
0
@@ -2,8 +2,8 @@ class SecureMagic::Application < Merb::Controller
0
   
0
   controller_for_slice
0
   
0
- def use_app_layout
0
- self.send Application.default_render_options[:layout]
0
- end
0
+ #def use_app_layout
0
+ # self.send Application.default_render_options[:layout]
0
+ #end
0
   
0
 end
0
\ No newline at end of file
...
25
26
27
28
29
30
31
32
33
34
35
36
...
25
26
27
 
 
 
 
 
 
28
29
30
0
@@ -25,11 +25,5 @@ class SecureMagic::Session < SecureMagic::Application
0
     reset_session
0
     redirect_back_or_default('/')
0
   end
0
-
0
- def app_layout
0
- host = request.host_name
0
- puts "Request host: #{host}"
0
- host
0
- end
0
   
0
 end
0
\ No newline at end of file
...
13
14
15
16
 
 
17
18
19
...
67
68
69
 
 
 
 
70
71
72
...
13
14
15
 
16
17
18
19
20
...
68
69
70
71
72
73
74
75
76
77
0
@@ -13,7 +13,8 @@ if defined?(Merb::Plugins)
0
   # Configuration options:
0
   # :layout - the layout to use; defaults to :secure_magic
0
   # :mirror - which path component types to use on copy operations; defaults to all
0
- Merb::Slices::config[:secure_magic][:layout] = :use_app_layout
0
+ #Merb::Slices::config[:secure_magic] ||= {}
0
+ #Merb::Slices::config[:secure_magic][:layout] = :use_app_layout
0
   
0
   # load the controller extensions
0
   require 'secure_magic_controller.rb'
0
@@ -67,6 +68,10 @@ if defined?(Merb::Plugins)
0
         name(:secure_magic_passord_changed)
0
       scope.match("/accounts/lost_password").to(:controller => "Accounts", :action => "lost_password").
0
         name(:secure_magic_lost_password)
0
+ scope.match("/accounts/my_account").to(:controller => "Accounts", :action => "my_account").
0
+ name(:secure_magic_my_account)
0
+ scope.match("/current_account").to(:controller => "Accounts", :action => "current_account_name").
0
+ name(:secure_magic_current_account)
0
       scope.resources :accounts
0
       scope.resources :session
0
     end

Comments

    No one has commented yet.