pipa-authmagic 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -67,11 +67,8 @@ module Authmagic
67
67
  end
68
68
 
69
69
  def current_principal
70
- unless defined? @current_principal
71
- id = current_principal_id
72
- @current_principal = security_context.principal.find_by_id(id) if id
73
- end
74
- @current_principal
70
+ id = current_principal_id
71
+ id && security_context.principal.find(id) rescue ActiveRecord::RecordNotFound nil
75
72
  end
76
73
 
77
74
  def require_login!
@@ -99,6 +96,10 @@ module Authmagic
99
96
  u, session[:back_url] = session[:back_url], nil
100
97
  redirect_to(u || default)
101
98
  end
99
+
100
+ def unauthenticate
101
+ session[:current_principal_id] = nil
102
+ end
102
103
  end
103
104
 
104
105
  module SessionControllerMethods
@@ -70,11 +70,10 @@ module Authmagic
70
70
  end
71
71
  end
72
72
 
73
- define_method password do
74
- nil
75
- end
73
+ attr_reader password
76
74
 
77
75
  define_method password_set do |passw|
76
+ instance_variable_set("@#{password}", passw)
78
77
  send(salt_set, send(generate_salt))
79
78
  send(password_hash_set, send(encryptor, passw))
80
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pipa-authmagic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Gunko
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-17 00:00:00 -08:00
12
+ date: 2009-01-20 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency