Small fix for #303

Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
James Cole
2016-09-01 19:01:08 +02:00
parent f3a8a25872
commit 2ce5142b06
2 changed files with 14 additions and 7 deletions

View File

@@ -111,7 +111,8 @@ class AuthController extends Controller
{ {
// is allowed to? // is allowed to?
$singleUserMode = FireflyConfig::get('single_user_mode', Config::get('firefly.configuration.single_user_mode'))->data; $singleUserMode = FireflyConfig::get('single_user_mode', Config::get('firefly.configuration.single_user_mode'))->data;
if ($singleUserMode === true) { $userCount = User::count();
if ($singleUserMode === true && $userCount > 0) {
$message = 'Registration is currently not available.'; $message = 'Registration is currently not available.';
return view('error', compact('message')); return view('error', compact('message'));
@@ -164,8 +165,13 @@ class AuthController extends Controller
{ {
// is allowed to? // is allowed to?
$singleUserMode = FireflyConfig::get('single_user_mode', Config::get('firefly.configuration.single_user_mode'))->data; $singleUserMode = FireflyConfig::get('single_user_mode', Config::get('firefly.configuration.single_user_mode'))->data;
$userCount = User::count();
$allowRegistration = true;
if ($singleUserMode === true && $userCount > 0) {
$allowRegistration = false;
}
return view('auth.login', compact('singleUserMode')); return view('auth.login', compact('allowRegistration'));
} }
/** /**
@@ -179,7 +185,8 @@ class AuthController extends Controller
// is allowed to? // is allowed to?
$singleUserMode = FireflyConfig::get('single_user_mode', Config::get('firefly.configuration.single_user_mode'))->data; $singleUserMode = FireflyConfig::get('single_user_mode', Config::get('firefly.configuration.single_user_mode'))->data;
if ($singleUserMode === true) { $userCount = User::count();
if ($singleUserMode === true && $userCount > 0) {
$message = 'Registration is currently not available.'; $message = 'Registration is currently not available.';
return view('error', compact('message')); return view('error', compact('message'));

View File

@@ -53,7 +53,7 @@
<!-- /.col --> <!-- /.col -->
</div> </div>
</form> </form>
{% if not singleUserMode %} {% if allowRegistration %}
<a href="{{ URL.to('/register') }}" class="text-center">Register a new account</a><br> <a href="{{ URL.to('/register') }}" class="text-center">Register a new account</a><br>
{% endif %} {% endif %}
<a href="{{ URL.to('/password/reset') }}">I forgot my password</a> <a href="{{ URL.to('/password/reset') }}">I forgot my password</a>