File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6666# by the desktop app to see if you've entered correct information.
6767post '/check_credentials' do
6868 #let's see if we got a correct username/password:
69- puts "username: #{ params [ :username ] } / #{ params [ :password ] } "
7069 if Hacker . authenticate ( params [ :username ] , params [ :password ] )
7170 "Success"
7271 else
7372 halt 401
7473 end
7574end
75+
76+ # This method will let people sign up from within the app. Frankly this is
77+ # a really bad way to do it, but I'm not sure what the best way is. It should
78+ # be combined with the signup method above. The issue is that signup via the
79+ # API should really just throw the message rather than redirect, but the site
80+ # should redirect. This probably should be managed via content negotiation. I'm
81+ # doing it the dirty way now, and when I look at exposing a Real Api I'll worry
82+ # about making it 100% nice.
83+ post '/signup_via_api' do
84+ @hacker = Hacker . create ( :username => params [ :username ] ,
85+ :email => params [ :email ] ,
86+ :password => params [ :password ] )
87+
88+ if @hacker && @hacker . valid?
89+ "Success"
90+ else
91+ 404 #is this right?
92+ end
93+ end
You can’t perform that action at this time.
0 commit comments