Skip to content

Commit

Permalink
Merge pull request #13235 from TheStranjer/allow-random-welcome-bgs
Browse files Browse the repository at this point in the history
Allow Riot Web to randomly pick welcome backgrounds
  • Loading branch information
turt2live authored Apr 17, 2020
2 parents 8122c62 + b3f3126 commit 19130dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ For a good example, see https://riot.im/develop/config.json.
homeserver know what email template to use when talking to you.
1. `branding`: Configures various branding and logo details, such as:
1. `welcomeBackgroundUrl`: An image to use as a wallpaper outside the app
during authentication flows
during authentication flows. If an array is passed, an image is chosen randomly for each visit.
1. `authHeaderLogoUrl`: An logo image that is shown in the header during
authentication flows
1. `authFooterLinks`: a list of links to show in the authentication page footer:
Expand Down
6 changes: 5 additions & 1 deletion src/components/views/auth/VectorAuthPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ export default class VectorAuthPage extends React.PureComponent {
const brandingConfig = SdkConfig.get().branding;
let backgroundUrl = "themes/riot/img/backgrounds/valley.jpg";
if (brandingConfig && brandingConfig.welcomeBackgroundUrl) {
backgroundUrl = brandingConfig.welcomeBackgroundUrl;
if (Array.isArray(brandingConfig.welcomeBackgroundUrl)) {
backgroundUrl = brandingConfig.welcomeBackgroundUrl[Math.floor(Math.random() * brandingConfig.welcomeBackgroundUrl.length)];
} else {
backgroundUrl = brandingConfig.welcomeBackgroundUrl;
}
}

const pageStyle = {
Expand Down

0 comments on commit 19130dc

Please sign in to comment.