Skip to content

Commit abec8d1

Browse files
committed
Formatting tweaks, dropping below 80 chars per line.
1 parent 9a7f8b6 commit abec8d1

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

app.rb

+16-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ class User
1414
DataMapper.finalize
1515
DataMapper.auto_upgrade!
1616

17-
# You'll need to customize the following line. Replace the CONSUMER_KEY and CONSUMER_SECRET with the values you got from Twitter (https://dev.twitter.com/apps/new).
17+
# You'll need to customize the following line. Replace the CONSUMER_KEY
18+
# and CONSUMER_SECRET with the values you got from Twitter
19+
# (https://dev.twitter.com/apps/new).
1820
use OmniAuth::Strategies::Twitter, 'CONSUMER_KEY', 'CONSUMER_SECRET'
1921

2022
enable :sessions
@@ -27,23 +29,32 @@ def current_user
2729

2830
get '/' do
2931
if current_user
30-
# the following line just tests to see that it's working. If you've logged in your first user, '/' should load: "1 ... 1"; You can then remove the following line, start using view templates, etc.
32+
# The following line just tests to see that it's working.
33+
# If you've logged in your first user, '/' should load: "1 ... 1";
34+
# You can then remove the following line, start using view templates, etc.
3135
current_user.id.to_s + " ... " + session[:user_id].to_s
3236
else
3337
'<a href="/sign_up">create an account</a> or <a href="/sign_in">sign in with Twitter</a>'
34-
# if you replace the above line with the following line, the user gets signed in automatically. Could be useful. Could also break user expectations.
38+
# if you replace the above line with the following line,
39+
# the user gets signed in automatically. Could be useful.
40+
# Could also break user expectations.
3541
# redirect '/auth/twitter'
3642
end
3743
end
3844

3945
get '/auth/:name/callback' do
4046
auth = request.env["omniauth.auth"]
41-
user = User.first_or_create({ :uid => auth["uid"]}, { :uid => auth["uid"], :nickname => auth["user_info"]["nickname"], :name => auth["user_info"]["name"], :created_at => Time.now })
47+
user = User.first_or_create({ :uid => auth["uid"]}, {
48+
:uid => auth["uid"],
49+
:nickname => auth["user_info"]["nickname"],
50+
:name => auth["user_info"]["name"],
51+
:created_at => Time.now })
4252
session[:user_id] = user.id
4353
redirect '/'
4454
end
4555

46-
# any of the following routes should work to sign the user in: /sign_up, /signup, /sign_in, /signin, /log_in, /login
56+
# any of the following routes should work to sign the user in:
57+
# /sign_up, /signup, /sign_in, /signin, /log_in, /login
4758
["/sign_in/?", "/signin/?", "/log_in/?", "/login/?", "/sign_up/?", "/signup/?"].each do |path|
4859
get path do
4960
redirect '/auth/twitter'

0 commit comments

Comments
 (0)