Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

support noauth #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#USE_SVG=false
#API_TOKEN=changeme

# OAuth type (either 'google' or 'github')
# OAuth type (either 'google', 'github', or 'noauth')
#OAUTH_PROVIDER=google

# Google OpenID
Expand Down
10 changes: 9 additions & 1 deletion config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ use OmniAuth::Builder do
:domain => ENV['GOOGLE_OAUTH_DOMAIN']
end

run Rack::URLMap.new('/' => Descartes::Web, '/auth/github' => Descartes::GithubAuth)
class Descartes::NoAuth < Sinatra::Base
before do
session['user'] = { 'uid' => 'anonymous', 'email' => 'noemail' }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe i don't understand the concept of noauth well enough. But why not 'email' => nil?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just didn't understand the use of the email field's usage well enough

redirect '/'
end
end

run Rack::URLMap.new('/' => Descartes::Web, '/auth/github' => Descartes::GithubAuth,
'/auth/noauth' => Descartes::NoAuth)

# seed our Metrics list at startup
Metric.load unless ENV['METRICS_UPDATE_ON_BOOT'] == 'false'
Expand Down