Skip to content

Commit

Permalink
fix(ui): custom page login not showing on MFA page #621
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Jul 29, 2023
1 parent bb56646 commit 16330e9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 63 deletions.
22 changes: 13 additions & 9 deletions src/controllers/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const passport = require('passport')
const winston = require('winston')
const pkg = require('../../package')
const xss = require('xss')
const settingsUtil = require('../settings/settingsUtil')
const RateLimiterMemory = require('rate-limiter-flexible').RateLimiterMemory

const limiterSlowBruteByIP = new RateLimiterMemory({
Expand Down Expand Up @@ -107,11 +108,9 @@ mainController.dashboard = function (req, res) {

mainController.loginPost = async function (req, res, next) {
let ipAddress = req.ip
if (process.env.USE_XFORWARDIP == 'true')
ipAddress= req.headers["x-forwarded-for"]

if (process.env.USE_USERRATELIMIT == 'true')
ipAddress = ipAddress + req.body['username']
if (process.env.USE_XFORWARDIP == 'true') ipAddress = req.headers['x-forwarded-for']

if (process.env.USE_USERRATELIMIT == 'true') ipAddress = ipAddress + req.body['username']

const [resEmailAndIP] = await Promise.all([limiterSlowBruteByIP.get(ipAddress)])

Expand Down Expand Up @@ -591,14 +590,19 @@ mainController.l2authget = function (req, res) {
content.title = 'Login'
content.layout = false

const settings = require('../models/setting')
settings.getSettingByName('mailer:enable', function (err, setting) {
settingsUtil.getSettings(function (err, settingsFull) {
if (err) {
throw new Error(err)
}

if (!_.isNull(setting)) {
content.mailerEnabled = setting.value
const settings = settingsFull.data?.settings

if (!_.isNull(settings) && !_.isNull(settings.mailerEnabled)) {
content.mailerEnabled = settings.mailerEnabled.value
}
content.pageLogo = '/img/defaultLogoDark.png'
if (settings.hasCustomPageLogo.value && settings.customPageLogoFilename.value.length > 0) {
content.pageLogo = '/assets/' + settings.customPageLogoFilename.value
}

return res.render('login-otp', content)
Expand Down
55 changes: 1 addition & 54 deletions src/views/login-otp.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -161,60 +161,7 @@
<p>{{#if flash.message}} {{{flash.message}}} {{else}} {{{flash}}}{{/if}}</p>
</div>
<div class="login-wrapper">

<!--<img src="/img/themes/bw/logoLarge.png" alt="Trudesk Logo" /> <br />-->

<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 288.9 70.1" style="enable-background:new 0 0 288.9 70.1;" xml:space="preserve" class="uk-margin-large-bottom">
<style type="text/css">
.st0 {
fill: #555;
}
.st1 {
fill: #E74C3C;
}
</style>
<path class="st0" d="M28.5,28.4c-0.1,1.6-0.7,3.4-1.6,5.4c-2.4-0.3-4.6-0.4-6.8-0.4h-1.7c-2.9,13.9-4.3,22.6-4.3,26.1
c0,1.8,0.4,2.7,1.2,2.7c0.8,0,2.9-0.8,6.2-2.3l1.7,3.1C17.7,67.7,12.5,70,7.8,70c-2.2,0-4-0.7-5.4-2.1c-1.4-1.4-2.1-3.2-2.1-5.5
c0-2.3,0.3-4.9,0.8-7.7c0.5-2.9,1.3-6.4,2.2-10.6c0.9-4.2,1.6-7.5,2.1-10.1c-2.3,0.2-4,0.4-5.2,0.6c-0.1-0.8-0.2-1.8-0.2-3
c0-1.3,0.1-2.3,0.3-3.1h5.9c0.5-3.4,0.8-6.6,0.8-9.6L6.8,16v-0.3c4.9-1.7,9.5-2.5,13.8-2.5c0.2,1.3,0.4,2.8,0.4,4.7
c0,1.9-0.5,5.4-1.6,10.6H28.5z"/>
<path class="st0" d="M29.6,69.1H29c-0.1-0.5-0.2-1.6-0.2-3.4c0-1.8,0.8-6.6,2.5-14.4c1.7-7.8,2.5-12.3,2.5-13.4
c0-1.9-0.9-4.1-2.6-6.4l-0.8-1.1l0.1-1.2c3.4-0.9,8.8-1.4,16.2-1.4c0.8,1.6,1.1,3.9,1.1,6.8c0.7-1.1,2.1-2.6,4.3-4.5
c2.2-1.9,4.4-2.8,6.8-2.8c3.4,0,5.1,2.9,5.1,8.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9-2.5-7-7.6-12.2
c-5.1-5.3-7.6-9.5-7.6-12.6c0-3.1,1.4-5.5,4.2-7.3c2.8-1.7,6.2-2.6,10.2-2.6c4,0,7,0.7,9,2.1c2,1.4,3,3.3,3,5.7
c0,2.4-1.9,5.7-5.7,10c0.4,0.4,1,1,1.7,1.7c0.7,0.7,1.6,2.1,2.7,4.1C222.6,52.9,223.2,54.8,223.2,56.6z M218.1,35.2
c0-2.2-1.5-3.3-4.5-3.3c-1.4,0-2.6,0.3-3.6,0.9c-0.9,0.6-1.4,1.3-1.4,2c0,1.4,1.4,3.3,4.1,5.8l1.4,1.2
C216.8,39.6,218.1,37.4,218.1,35.2z"/>
<path class="st0" d="M238.1,6.9c0-2.1-0.2-3.5-0.6-4.4C242.4,0.8,247,0,251.3,0c0.6,0.6,0.8,2,0.8,4.3c0,5.2-1.7,15.1-5.2,29.8
c5.6-4.6,11.1-6.8,16.5-6.8c2.4,0,4.5,0.8,6.2,2.3c1.7,1.5,2.5,3.7,2.5,6.6c0,5.4-4.4,9.3-13.2,11.7c2.1,6.5,3.9,10.9,5.4,13.2
c0.7,1,1.2,1.5,1.5,1.5c0.7,0,2.1-0.5,4.3-1.6l1-0.5l1.5,3.2c-1.5,1.4-3.6,2.8-6.2,4.2c-2.7,1.4-5.1,2.1-7.3,2.1
c-4.9,0-8.3-4.4-10.2-13.3c-0.9-3.8-1.4-7.4-1.6-10.7c4-0.9,7-2.1,9-3.4c2-1.3,3-3.1,3-5.2c0-2.1-1.1-3.1-3.2-3.1
c-2.1,0-5.7,2.1-10.7,6.4c-3.1,13.2-4.7,22.2-4.7,27.1c-3.4,1-7.9,1.5-13.4,1.5c-0.1-1.1-0.1-2-0.1-2.8c0-2.7,1.8-11.9,5.4-27.6
C236.3,23.1,238.1,12.5,238.1,6.9z"/>
<circle class="st1" cx="284.9" cy="64.7" r="4"/>
</svg>
<img src="{{pageLogo}}" alt="Logo" class="site-logo-login" />

<div class="level2auth" style="margin-top: 25px;">
<form action="/l2auth" id="level2auth" method="post">
Expand Down

0 comments on commit 16330e9

Please sign in to comment.