lib/osso/routes/admin.rb in osso-0.1.0 vs lib/osso/routes/admin.rb in osso-0.1.1
- old
+ new
@@ -9,10 +9,11 @@
class Admin < Roda
DB = Sequel.postgres(extensions: :activerecord_connection)
use Rack::Session::Cookie, secret: ENV.fetch('SESSION_SECRET')
plugin :json
+ plugin :json_parser
plugin :middleware
plugin :render, engine: 'erb', views: ENV['RODAUTH_VIEWS'] || DEFAULT_VIEWS_DIR
plugin :route_csrf
plugin :rodauth do
@@ -69,9 +70,18 @@
merge({ rodauth: rodauth })
end
r.on 'admin' do
erb :admin, layout: false
+ end
+
+ r.post 'idp' do
+ onboarded = Osso::Models::IdentityProvider.
+ not_pending.
+ where(domain: r.params['domain']).
+ exists?
+
+ { onboarded: onboarded }.to_json
end
r.post 'graphql' do
rodauth.require_authentication