mirror of https://github.com/realaravinth/gitpad
feat: demo user banner on login and register pages
parent
2db966c04a
commit
53cb808083
|
@ -25,9 +25,10 @@ pub mod register;
|
|||
mod test;
|
||||
|
||||
pub const AUTH_BASE: TemplateFile = TemplateFile::new("authbase", "pages/auth/base.html");
|
||||
pub const DEMO: TemplateFile = TemplateFile::new("demo_banner", "pages/auth/demo.html");
|
||||
|
||||
pub fn register_templates(t: &mut tera::Tera) {
|
||||
for template in [AUTH_BASE, login::LOGIN, register::REGISTER].iter() {
|
||||
for template in [AUTH_BASE, login::LOGIN, register::REGISTER, DEMO].iter() {
|
||||
template.register(t).expect(template.name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,6 +117,9 @@ pub struct Footer<'a> {
|
|||
admin_email: &'a str,
|
||||
source_code: &'a str,
|
||||
git_hash: &'a str,
|
||||
settings: &'a Settings,
|
||||
demo_user: &'a str,
|
||||
demo_password: &'a str,
|
||||
}
|
||||
|
||||
impl<'a> Footer<'a> {
|
||||
|
@ -126,6 +129,9 @@ impl<'a> Footer<'a> {
|
|||
source_code: &settings.source_code,
|
||||
admin_email: &settings.admin_email,
|
||||
git_hash: &GIT_COMMIT_HASH[..8],
|
||||
demo_user: crate::demo::DEMO_USER,
|
||||
demo_password: crate::demo::DEMO_PASSWORD,
|
||||
settings,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ use std::{env, fs};
|
|||
use config::{Config, ConfigError, Environment, File};
|
||||
use derive_more::Display;
|
||||
use log::warn;
|
||||
use serde::Deserialize;
|
||||
use serde::*;
|
||||
use url::Url;
|
||||
use validator::Validate;
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Server {
|
||||
pub port: u32,
|
||||
pub domain: String,
|
||||
|
@ -41,7 +41,7 @@ impl Server {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Display, Clone, Debug)]
|
||||
#[derive(Serialize, Deserialize, Display, Clone, Debug)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum LogLevel {
|
||||
#[display(fmt = "debug")]
|
||||
|
@ -65,7 +65,7 @@ impl LogLevel {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[derive(Serialize, Debug, Clone, Deserialize)]
|
||||
pub struct Repository {
|
||||
pub root: String,
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ impl Repository {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Display, PartialEq, Clone, Debug)]
|
||||
#[derive(Deserialize, Serialize, Display, PartialEq, Clone, Debug)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum DBType {
|
||||
#[display(fmt = "postgres")]
|
||||
|
@ -103,7 +103,7 @@ impl DBType {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
struct DatabaseBuilder {
|
||||
pub port: u32,
|
||||
pub hostname: String,
|
||||
|
@ -131,14 +131,14 @@ impl DatabaseBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct Database {
|
||||
pub url: String,
|
||||
pub pool: u32,
|
||||
pub database_type: DBType,
|
||||
}
|
||||
|
||||
#[derive(Debug, Validate, Clone, Deserialize)]
|
||||
#[derive(Debug, Validate, Clone, Deserialize, Serialize)]
|
||||
pub struct Settings {
|
||||
pub log: LogLevel,
|
||||
pub database: Database,
|
||||
|
|
|
@ -8,20 +8,24 @@ html {
|
|||
color: #333;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2.0rem;
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
|
@ -227,7 +231,6 @@ footer {
|
|||
height: 320px;
|
||||
}
|
||||
|
||||
|
||||
.gist__button-group {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
|
@ -249,3 +252,14 @@ footer {
|
|||
cursor: pointer;
|
||||
background-color: #e9e9ed;
|
||||
}
|
||||
|
||||
.auth__demo-user__banner {
|
||||
margin: auto;
|
||||
margin-top: 5px;
|
||||
font-size: 0.8rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.auth__demo-user__cred {
|
||||
font-family: monospace, monospace;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
{% if footer.settings.allow_demo %}
|
||||
<p class="auth__demo-user__banner">
|
||||
Try Kaizen without joining<br />
|
||||
<span class="auth__demo-user__cred" >
|
||||
<b>user:</b> {{ footer.demo_user }}
|
||||
</span>
|
||||
<span class="auth__demo-user__cred">
|
||||
<b>password:</b> {{ footer.demo_password }}
|
||||
</span>
|
||||
</p>
|
||||
{% endif %}
|
|
@ -31,7 +31,6 @@
|
|||
{% endif %}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<div class="form__action-container">
|
||||
<a href="/forgot-password">Forgot password?</a>
|
||||
<button class="form__submit" type="submit">Login</button>
|
||||
|
@ -42,4 +41,5 @@
|
|||
New to GitPad?
|
||||
<a href="{{ page.auth.register }}">Create an account </a>
|
||||
</p>
|
||||
{% include "demo_banner" %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
{% endif %}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<div class="form__action-container">
|
||||
<a href="/forgot-password">Forgot password?</a>
|
||||
<button class="form__submit" type="submit">Sign Up</button>
|
||||
|
@ -71,4 +70,5 @@
|
|||
Already have an account?
|
||||
<a href="{{ page.auth.login }}"> Login </a>
|
||||
</p>
|
||||
{% include "demo_banner" %}
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue