Browse Source

don't fall back to default auth for micropub login

pull/23/head
Aaron Parecki 7 years ago
parent
commit
e7f90f6b7f
No known key found for this signature in database GPG Key ID: 276C2817346D6056
2 changed files with 5 additions and 6 deletions
  1. +4
    -5
      compass/app/Http/Controllers/Controller.php
  2. +1
    -1
      compass/resources/views/settings.blade.php

+ 4
- 5
compass/app/Http/Controllers/Controller.php View File

@ -211,6 +211,10 @@ class Controller extends BaseController
$authorizationEndpoint = \IndieAuth\Client::discoverAuthorizationEndpoint($me); $authorizationEndpoint = \IndieAuth\Client::discoverAuthorizationEndpoint($me);
if(!$authorizationEndpoint) {
return view('auth/error', ['error' => 'No Authorization Endpoint Specified']);
}
// Isolate session variables to this variable only // Isolate session variables to this variable only
session([$dbName => [ session([$dbName => [
'auth_state' => $state, 'auth_state' => $state,
@ -218,11 +222,6 @@ class Controller extends BaseController
'authorization_endpoint' => $authorizationEndpoint 'authorization_endpoint' => $authorizationEndpoint
]]); ]]);
// If the user specified only an authorization endpoint, use that
if(!$authorizationEndpoint) {
// Otherwise, fall back to indieauth.com
$authorizationEndpoint = env('DEFAULT_AUTH_ENDPOINT');
}
$authorizationURL = \IndieAuth\Client::buildAuthorizationURL($authorizationEndpoint, $me, $this->_databaseRedirectURI($dbName), env('BASE_URL'), $state, 'create'); $authorizationURL = \IndieAuth\Client::buildAuthorizationURL($authorizationEndpoint, $me, $this->_databaseRedirectURI($dbName), env('BASE_URL'), $state, 'create');
return redirect($authorizationURL); return redirect($authorizationURL);

+ 1
- 1
compass/resources/views/settings.blade.php View File

@ -92,7 +92,7 @@
<form action="/settings/{{ $database->name }}/auth/start" method="post" class="ui form"> <form action="/settings/{{ $database->name }}/auth/start" method="post" class="ui form">
<div class="field"> <div class="field">
<label for="micropub_endpoint">web sign-in</label> <label for="micropub_endpoint">web sign-in</label>
<input name="me" type="url" placeholder="http://example.com/" class="pure-input-1" value="">
<input name="me" type="url" placeholder="https://example.com/" class="pure-input-1" value="">
</div> </div>
<button type="submit" class="ui button primary">Connect</button> <button type="submit" class="ui button primary">Connect</button>

Loading…
Cancel
Save