appoxy_sessions 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,7 +41,6 @@ module Appoxy
|
|
41
41
|
|
42
42
|
protected
|
43
43
|
|
44
|
-
#
|
45
44
|
def random_string(length=10)
|
46
45
|
chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'
|
47
46
|
password = ''
|
@@ -49,6 +48,29 @@ module Appoxy
|
|
49
48
|
password
|
50
49
|
end
|
51
50
|
|
51
|
+
def authenticate
|
52
|
+
if !logged_in?
|
53
|
+
flash[:warning] = "You need to login to access this page."
|
54
|
+
session[:return_to] = request.request_uri # return to after logging in
|
55
|
+
puts "ac=" + params[:activation_code].inspect
|
56
|
+
if params[:uid] && params[:activation_code]
|
57
|
+
# then from an invite
|
58
|
+
user = User.find(params[:uid])
|
59
|
+
# this the best way to decide of user has not logged in? Could also check status.
|
60
|
+
redirect_to :controller=>"users", :action=>"new", :email=>user.email, :activation_code=>params[:activation_code] and return if user.password.blank?
|
61
|
+
|
62
|
+
end
|
63
|
+
redirect_to :controller=>"users", :action=>"new", :activation_code=>params[:activation_code]
|
64
|
+
end
|
65
|
+
|
66
|
+
after_authenticate
|
67
|
+
|
68
|
+
end
|
69
|
+
def after_authenticate
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
|
52
74
|
|
53
75
|
end
|
54
76
|
|
data/lib/sessions/user.rb
CHANGED
@@ -5,7 +5,7 @@ module Appoxy
|
|
5
5
|
class User < SimpleRecord::Base
|
6
6
|
|
7
7
|
def self.included(base)
|
8
|
-
|
8
|
+
puts self.name + " included in " + base.name
|
9
9
|
end
|
10
10
|
|
11
11
|
|
@@ -50,7 +50,6 @@ module Appoxy
|
|
50
50
|
def activate!
|
51
51
|
self.activation_code=nil
|
52
52
|
self.status = "active"
|
53
|
-
self.save(:dirty=>true)
|
54
53
|
end
|
55
54
|
|
56
55
|
|
@@ -64,10 +64,10 @@ module Appoxy
|
|
64
64
|
self.current_user = @user
|
65
65
|
flash[:success] = "Your account was created successfully."
|
66
66
|
after_save_in_create
|
67
|
+
after_create
|
67
68
|
else
|
68
69
|
render :action => "new"
|
69
70
|
end
|
70
|
-
after_create
|
71
71
|
|
72
72
|
end
|
73
73
|
|
@@ -91,12 +91,11 @@ module Appoxy
|
|
91
91
|
# Usually a user gets here via an activation link in email.
|
92
92
|
def activate
|
93
93
|
logout_keeping_session!
|
94
|
-
|
95
|
-
@user = ::User.find_by_activation_code(params[:activation_code]) unless params[:activation_code].blank?
|
94
|
+
@user = User.find_by_activation_code(params[:activation_code]) unless params[:activation_code].blank?
|
96
95
|
case
|
97
|
-
when params[:activation_code].
|
96
|
+
when (!params[:activation_code].blank?) && @user && !@user.is_active?
|
97
|
+
flash[:info] = "Account activated. please login."
|
98
98
|
@user.activate!
|
99
|
-
flash[:success] = "Account activated. please login."
|
100
99
|
redirect_to login_url
|
101
100
|
when params[:activation_code].blank?
|
102
101
|
flash[:error] = "The activation code was missing. Please follow the URL from your email."
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appoxy_sessions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Reeder
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-05 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|