Skip to content

Commit 994d4aa

Browse files
authored
Merge pull request #8528 from jryans/config-branding
Support configurable welcome background and logo
2 parents 1ec9763 + 678904d commit 994d4aa

File tree

3 files changed

+34
-23
lines changed

3 files changed

+34
-23
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ For a good example, see https://riot.im/develop/config.json
127127
release to release.
128128
1. `brand`: String to pass to your homeserver when configuring email notifications, to let the
129129
homeserver know what email template to use when talking to you.
130+
1. `branding`: Configures various branding and logo details, such as:
131+
1. `welcomeBackgroundUrl`: An image to use as a wallpaper outside the app
132+
during authentication flows
133+
1. `authHeaderLogoUrl`: An logo image that is shown in the header during
134+
authentication flows
130135
1. `integrations_ui_url`: URL to the web interface for the integrations server. The integrations
131136
server is not Riot and normally not your homeserver either. The integration server settings
132137
may be left blank to disable integrations.

src/components/views/auth/VectorAuthHeaderLogo.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,26 @@ limitations under the License.
1919

2020
import React from 'react';
2121
import PropTypes from 'prop-types';
22+
import SdkConfig from 'matrix-react-sdk/lib/SdkConfig';
2223

23-
const LOGO_URI = "themes/riot/img/logos/riot-im-logo-black-text.svg";
24+
export default class VectorAuthHeaderLogo extends React.PureComponent {
25+
static replaces = 'AuthHeaderLogo'
2426

25-
module.exports = React.createClass({
26-
displayName: 'VectorAuthHeaderLogo',
27-
statics: {
28-
replaces: 'AuthHeaderLogo',
29-
},
30-
propTypes: {
27+
static propTypes = {
3128
icon: PropTypes.string,
32-
},
29+
}
30+
31+
render() {
32+
const brandingConfig = SdkConfig.get().branding;
33+
let logoUrl = "themes/riot/img/logos/riot-im-logo-black-text.svg";
34+
if (brandingConfig && brandingConfig.authHeaderLogoUrl) {
35+
logoUrl = brandingConfig.authHeaderLogoUrl;
36+
}
3337

34-
render: function() {
3538
return (
3639
<div className="mx_AuthHeaderLogo">
37-
<img src={LOGO_URI} alt="Riot" />
40+
<img src={logoUrl} alt="Riot" />
3841
</div>
3942
);
40-
},
41-
});
43+
}
44+
}

src/components/views/auth/VectorAuthPage.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,24 @@ limitations under the License.
1616

1717
'use strict';
1818

19-
const React = require('react');
19+
import React from 'react';
2020
import sdk from 'matrix-react-sdk/lib/index';
21+
import SdkConfig from 'matrix-react-sdk/lib/SdkConfig';
2122

22-
module.exports = React.createClass({
23-
displayName: 'VectorAuthPage',
23+
export default class VectorAuthPage extends React.PureComponent {
24+
static replaces = 'AuthPage'
2425

25-
statics: {
26-
replaces: 'AuthPage',
27-
},
28-
29-
render: function() {
26+
render() {
3027
const AuthFooter = sdk.getComponent('auth.AuthFooter');
3128

29+
const brandingConfig = SdkConfig.get().branding;
30+
let backgroundUrl = "themes/riot/img/backgrounds/valley.jpg";
31+
if (brandingConfig && brandingConfig.welcomeBackgroundUrl) {
32+
backgroundUrl = brandingConfig.welcomeBackgroundUrl;
33+
}
34+
3235
const pageStyle = {
33-
background: 'center/cover fixed url(themes/riot/img/backgrounds/valley.jpg)',
36+
background: `center/cover fixed url(${backgroundUrl})`,
3437
};
3538

3639
const modalStyle = {
@@ -66,5 +69,5 @@ module.exports = React.createClass({
6669
<AuthFooter />
6770
</div>
6871
);
69-
},
70-
});
72+
}
73+
}

0 commit comments

Comments
 (0)