Merge pull request #7585 from philipsd6/enable-html-custom-login-info

Safely enable HTML in Custom Login Info

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot]
2020-07-10 12:57:17 +00:00
committed by GitHub
3 changed files with 7 additions and 2 deletions

View File

@@ -88,6 +88,7 @@ export default ['$log', '$cookies', '$rootScope', 'ProcessErrors',
} }
scope.customLoginInfo = $AnsibleConfig.custom_login_info; scope.customLoginInfo = $AnsibleConfig.custom_login_info;
scope.customLoginInfoPresent = (scope.customLoginInfo) ? true : false; scope.customLoginInfoPresent = (scope.customLoginInfo) ? true : false;
scope.customLoginInfoIsHTML = /<\/?[a-z][\s\S]*>/i.test(scope.customLoginInfo);
}); });
if (scope.removeAuthorizationGetLicense) { if (scope.removeAuthorizationGetLicense) {

View File

@@ -98,7 +98,12 @@
</div> </div>
</div> </div>
</form> </form>
<div id="login_modal_notice" class="LoginModalNotice" ng-if="customLoginInfoPresent"><div class="LoginModalNotice-title" translate>NOTICE</div>{{ customLoginInfo | sanitize }}</div> <div id="login_modal_notice" class="LoginModalNotice" ng-if="customLoginInfoPresent">
<div class="LoginModalNotice-title" translate>NOTICE</div>
<ng-bind-html ng-bind-html="customLoginInfo"
ng-style="{'white-space' : customLoginInfoIsHTML ? 'initial' : 'pre-wrap'}">
</ng-bind-html>
</div>
</div> </div>
<div class="LoginModal-footer"> <div class="LoginModal-footer">
<div class="LoginModal-footerBlock"> <div class="LoginModal-footerBlock">

View File

@@ -12,7 +12,6 @@
color: @login-notice-text; color: @login-notice-text;
overflow-y: scroll; overflow-y: scroll;
overflow-x: visible; overflow-x: visible;
white-space: pre-wrap;
} }
.LoginModalNotice-title { .LoginModalNotice-title {