Skip to content

Commit 17e7f65

Browse files
authored
Merge pull request #13 from bgeo-gis/custom-background-logo-images
Add custom logo and background from ldap-auth config
2 parents 1cec806 + 9797227 commit 17e7f65

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

src/server.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ def login():
216216
if current_user.is_authenticated:
217217
return redirect(target_url)
218218
form = LDAPLoginForm(meta=wft_locales())
219+
form.logo = config.get("logo_image_url", {})
220+
form.background = config.get("background_image_url", {})
221+
219222
if form.validate_on_submit():
220223
user = form.user
221224
# flask_login stores user in session

src/static/style.css

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,31 @@
55
*:focus {
66
outline: none;
77
}
8-
body {
8+
html, body {
99
font-family: Arial;
1010
background-color: #a0a0a0;
1111
padding: 50px;
12+
margin: 0;
13+
padding: 0;
14+
height: 100%;
1215
}
16+
17+
.form-background {
18+
position: fixed;
19+
left: 0;
20+
right: 0;
21+
top: 0;
22+
bottom: 0;
23+
background-repeat: no-repeat;
24+
background-size: cover;
25+
background-position: center;
26+
}
27+
1328
.login {
14-
margin: 20px auto;
29+
margin: 50px auto;
1530
width: 300px;
1631
}
32+
1733
.login-screen {
1834
background-color: #FFF;
1935
padding: 20px;
@@ -24,7 +40,12 @@ body {
2440
text-align: center;
2541
color: #777;
2642
}
27-
43+
44+
.app-logo {
45+
width: 220px;
46+
height: 100px;
47+
}
48+
2849
.login-form {
2950
text-align: center;
3051
}

src/templates/base.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" type="text/css">
55
</head>
66
<body>
7+
{% if form.background %}
8+
<div class="form-background" style="background-image: url('{{form.background}}');">
9+
{% endif %}
710
{% with messages = get_flashed_messages() + form.errors.get('csrf_token', []) %}
811
{% if messages %}
912
<ul>

src/templates/login.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ <h1>{{ i18n.t('auth.login_page_title') }}</h1>
77
<div class="login">
88
<div class="login-screen">
99
<div class="app-title">
10+
{% if form.logo %}
11+
<img class="app-logo" src="{{form.logo}}" alt="logo" />
12+
{% endif %}
1013
<h1>{{ i18n.t('auth.login_form_title') }}</h1>
1114
</div>
1215

0 commit comments

Comments
 (0)