Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

strip spaces on openid url, cleanup campfire link

  • Loading branch information...
commit 678a972ab4d8d9ef755a49ceaf56be6da0e0b6e5 1 parent 08133ff
Eric Hutzelman authored
23 app/controllers/sessions_controller.rb
View
@@ -3,19 +3,20 @@ class SessionsController < ApplicationController
def create
open_id_authentication params[:openid_url]
end
-
+
def destroy
session[:user_id] = nil
redirect_to root_url
end
-
+
private
def open_id_authentication(identity_url)
- authenticate_with_open_id(identity_url,
- :optional => [:fullname, :email]) do |result, identity_url, registration|
+ identity_url.strip!
+ authenticate_with_open_id(identity_url,
+ :optional => [:fullname, :email]) do |result, identity_url, registration|
if result.successful?
- if @current_user = User.find_by_identity_url(identity_url)
+ if @current_user = User.find_by_identity_url(identity_url)
successful_login
else
forward_new_user identity_url, registration
@@ -32,13 +33,13 @@ def successful_login
session[:user_id] = @current_user.id
redirect_to(root_url)
end
-
+
def forward_new_user(identity_url, registration)
- new_user = User.new(:identity_url => identity_url,
- :email => registration['email'],
- :name => registration['fullname'])
+ new_user = User.new(:identity_url => identity_url,
+ :email => registration['email'],
+ :name => registration['fullname'])
flash[:user] = new_user
- redirect_to new_user_path
+ redirect_to new_user_path
end
-
+
end
8 app/helpers/pages_helper.rb
View
@@ -1,2 +1,10 @@
module PagesHelper
+
+ def campfire_link
+ link_to_if(current_user, 'Houston.rb campfire chat room',
+ 'http://zipzoomauto.campfirenow.com/1c8f5') do |name|
+ link_to(name, login_path)
+ end
+ end
+
end
9 app/views/pages/index.html.erb
View
@@ -15,12 +15,9 @@
meetings usually consist of a presentation by a member or guest followed by discussion.
If you can't make it to the meetings, please feel free to join the <%= link_to 'discussion group', posts_path %> and participate.
</p>
-<p>We now have a
- <%=
- link_to_if(current_user, 'Houston.rb campfire chat room', 'http://zipzoomauto.campfirenow.com/1c8f5') do |name|
- link_to(name, login_path)
- end
- %>. Please feel free to drop in if you are coworking or just want to chat with other Houston rubyists.
+<p>
+ We now have a <%= campfire_link %>. Please feel free to drop in if you are coworking or
+ just want to chat with other Houston rubyists.
</p>
<h2 class="title">how do you join?</h2>
Please sign in to comment.
Something went wrong with that request. Please try again.