Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add `authenticated?` helper method.

  • Loading branch information...
commit 91518633e929bb15089f418873cf0be73e4ba8ce 1 parent 9afc1b6
@twe4ked authored
Showing with 7 additions and 3 deletions.
  1. +4 −0 tmpfollow.rb
  2. +3 −3 views/index.haml
View
4 tmpfollow.rb
@@ -41,6 +41,10 @@ def flashes
"<p class='flash #{type}'>#{flash[type]}</p>" if flash[type] != nil
end.join("\n")
end
+
+ def authenticated?
+ session[:oauth_token] != nil && session[:oauth_token_secret] != nil
+ end
end
get '/' do
View
6 views/index.haml
@@ -1,6 +1,4 @@
-- if session[:oauth_token] == nil && session[:oauth_token_secret] == nil
- %a{:href => '/auth/twitter'} Authenticate with Twitter
-- else
+- if authenticated?
%form{action: '/follow', method: 'post'}
Follow
%input{disabled: true, value: '@', id: 'at'}
@@ -14,3 +12,5 @@
- Unfollow.all(oauth_token: session[:oauth_token], oauth_token_secret: session[:oauth_token_secret]).each do |unfollow|
%li
@#{unfollow.user} will be unfollowed on #{unfollow.date.strftime("%A, %b #{unfollow.date.day.ordinalize}")}
+- else
+ %a{:href => '/auth/twitter'} Authenticate with Twitter
Please sign in to comment.
Something went wrong with that request. Please try again.