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

@@ -110,8 +110,9 @@ class AuthController extends Controller
public function register(Request $request) public function register(Request $request)
{ {
// 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'));
@@ -163,9 +164,14 @@ class AuthController extends Controller
public function showLoginForm() public function showLoginForm()
{ {
// 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'));
} }
/** /**
@@ -178,8 +184,9 @@ class AuthController extends Controller
$showDemoWarning = env('SHOW_DEMO_WARNING', false); $showDemoWarning = env('SHOW_DEMO_WARNING', false);
// 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>