1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

(bug) hide create account links when public registrations disabled

This commit is contained in:
Sylvain 2022-05-30 14:19:32 +02:00
parent 838dbc85af
commit 931e19b331
5 changed files with 18 additions and 5 deletions

View File

@ -8,6 +8,7 @@
- Fix a bug: OIDC scopes are separated by spaces, not commas
- Fix a bug: unable to create OIDC custom scopes
- Fix a bug: enable admins to be invited to collaborate on projects
- Fix a bug: hide some links to create an account if public registrations is disabled
- Fix a security issue: updated rack to 2.2.3.1 to fix [CVE-2022-30123](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-30123) and [CVE-2022-30122](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-30122)

View File

@ -432,7 +432,7 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco
size: 'sm',
resolve: {
settingsPromise: ['Setting', function (Setting) {
return Setting.query({ names: "['confirmation_required']" }).$promise;
return Setting.query({ names: "['confirmation_required', 'public_registrations']" }).$promise;
}]
},
controller: ['$scope', '$uibModalInstance', '_t', 'settingsPromise', function ($scope, $uibModalInstance, _t, settingsPromise) {
@ -441,6 +441,9 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco
// email confirmation required before user sign-in?
$scope.confirmationRequired = settingsPromise.confirmation_required;
// is public registrations allowed?
$scope.publicRegistrations = (settingsPromise.public_registrations !== 'false');
$scope.login = function () {
Auth.login(user).then(function (user) {
// Authentication succeeded ...

View File

@ -1,7 +1,12 @@
Application.Directives.directive('members', ['Member',
function (Member) {
Application.Directives.directive('members', ['Member', 'Setting',
function (Member, Setting) {
return ({
restrict: 'E',
resolve: {
settingsPromise: ['Setting', function (Setting) {
return Setting.query({ names: "['public_registrations']" }).$promise;
}]
},
templateUrl: '/home/members.html',
link ($scope, element, attributes) {
// The last registered members who confirmed their addresses
@ -12,6 +17,10 @@ Application.Directives.directive('members', ['Member',
Member.lastSubscribed({ limit: 4 }, function (data) {
$scope.lastMembers = data;
});
Setting.query({ names: "['public_registrations']" }, function (data) {
// is public registrations allowed?
$scope.publicRegistrations = (data.public_registrations !== 'false');
});
};
// !!! MUST BE CALLED AT THE END of the directive

View File

@ -17,7 +17,7 @@
</div>
</div>
<div class="m-t-sm m-b-sm text-center" ng-if="!isAuthenticated()">
<div class="m-t-sm m-b-sm text-center" ng-if="!isAuthenticated()" ng-show="publicRegistrations">
<button ng-click="signup($event)" class="btn btn-warning-full width-70 font-sbold rounded text-sm" translate>{{ 'app.public.home.create_an_account' }}</button>
</div>

View File

@ -60,7 +60,7 @@
<button class="btn btn-valid btn-warning btn-block p-l btn-lg text-u-c r-b" ng-click="login()" ng-disabled="loginForm.$invalid" translate translate-default="OK">{{ 'app.shared.buttons.confirm' }}</button>
</div>
</div>
<p class="text-center font-sbold">
<p class="text-center font-sbold" ng-show="publicRegistrations">
<span translate translate-default="Not registered?">{{ 'app.public.common.not_registered_to_the_fablab' }}</span>
<br/>
<a ng-click="openSignup($event)" class="text-u-l" translate translate-default="Create an account">{{ 'app.public.common.create_an_account' }}</a></br>