Skip to content

Commit

Permalink
minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianTheCoder committed Apr 25, 2009
1 parent cfa1875 commit 86df63b
Show file tree
Hide file tree
Showing 13 changed files with 6 additions and 11 deletions.
1 change: 0 additions & 1 deletion environment.rb
Expand Up @@ -3,7 +3,6 @@
require 'couchrest'
require 'extlib'
require 'faker'
require 'stringex'
require 'ratpack'
require 'bcrypt'
require 'warden'
Expand Down
Binary file removed gems/cache/extlib-0.9.11.gem
Binary file not shown.
Binary file removed gems/cache/faker-0.3.1.gem
Binary file not shown.
Binary file removed gems/cache/jchris-couchrest-0.23.gem
Binary file not shown.
Binary file removed gems/cache/json-1.1.4.gem
Binary file not shown.
Binary file removed gems/cache/mime-types-1.16.gem
Binary file not shown.
Binary file removed gems/cache/ratpack-0.2.4.gem
Binary file not shown.
Binary file removed gems/cache/rest-client-0.9.2.gem
Binary file not shown.
Binary file removed gems/cache/rsl-stringex-0.9.3.gem
Binary file not shown.
1 change: 0 additions & 1 deletion models/user.rb
Expand Up @@ -55,7 +55,6 @@ def encrypt_password
end

def self.authenticate(login, password)
# login_param = Merb::Authentication::Strategies::Basic::Base.login_param
@u = self.by_email(:key => login).first
@u && @u.authenticated?(password) ? @u : nil
end
Expand Down
4 changes: 2 additions & 2 deletions strategies.rb
@@ -1,5 +1,5 @@
Warden::Manager.serialize_into_session{|user| p user;p user.id;user.id }
Warden::Manager.serialize_from_session{|id| id.nil? ? nil : User.get(id) }
Warden::Manager.serialize_into_session{|user| p "----------------";p user;p user.id; user.nil? ? nil : user.id }
Warden::Manager.serialize_from_session{|id| p "==============#{id}"; id.nil? ? nil : User.get(id) }

Warden::Strategies.add(:password) do
def valid?
Expand Down
8 changes: 3 additions & 5 deletions user_management.rb
Expand Up @@ -22,23 +22,21 @@ class UserManagement < Sinatra::Default

post '/login/?' do
if env['warden'].authenticated?(:password)
redirect '/'
redirect "/user/#{env['warden'].user}"
else
view :login
end
end

get '/logout/?' do
env['warden'].logout
p "warden"
p env['warden'].inspect
redirect '/'
redirect '/login'
end

post '/register/?' do
@user = User.new(params[:user])
if @user.save
redirect '/upgrade'
redirect "/user/#{@user.handle}"
else
view :new
end
Expand Down
3 changes: 1 addition & 2 deletions views/layout.erb
Expand Up @@ -28,9 +28,8 @@
<p class="quiet">
<a href="/about/">About</a> |
<a href="/contact/">Contact Us</a> |
<a href="/faq/">FAQ</a>
<a href="/faq/">FAQ</a> |
<a href="/logout">Logout</a>
<%= env['warden'].authenticated?(:password) %>
</p>
</div>
<hr class="bottom "/>
Expand Down

0 comments on commit 86df63b

Please sign in to comment.