Web Logout
This commit is contained in:
@@ -8,6 +8,8 @@ Documentation=man:systemd.service(5)
|
||||
Type=simple
|
||||
User=root
|
||||
Group=root
|
||||
RuntimeDirectory=mars-nwe-webui
|
||||
RuntimeDirectoryMode=0700
|
||||
WorkingDirectory=/
|
||||
|
||||
ExecStartPre=/bin/mkdir -p @MARS_NWE_LOG_DIR@
|
||||
|
||||
@@ -40,7 +40,8 @@ sub settings_nav_bar()
|
||||
return <<'EOF_NAV';
|
||||
<div class="settings-nav" style="position:sticky;top:0;z-index:20;margin:0 0 14px 0;padding:10px;background:#fffdf9;border:1px solid #ddcfba;border-radius:12px;box-shadow:0 4px 12px rgba(80,55,30,0.06);">
|
||||
<a class="settings-nav-back" style="display:inline-block;margin-right:10px;padding:7px 12px;border-radius:9px;background:#6d5d53;color:#fff;text-decoration:none;font-weight:bold;" href="javascript:history.back()">Back</a>
|
||||
<a class="settings-nav-main" style="display:inline-block;padding:7px 12px;border-radius:9px;background:#a32020;color:#fff;text-decoration:none;font-weight:bold;" href="/" target="_top">Main menu</a>
|
||||
<a class="settings-nav-main" style="display:inline-block;margin-right:10px;padding:7px 12px;border-radius:9px;background:#a32020;color:#fff;text-decoration:none;font-weight:bold;" href="/" target="_top">Main menu</a>
|
||||
<a class="settings-nav-logout" style="display:inline-block;padding:7px 12px;border-radius:9px;background:#8b4a1d;color:#fff;text-decoration:none;font-weight:bold;" href="/logout" target="_top">Logout</a>
|
||||
</div>
|
||||
EOF_NAV
|
||||
}
|
||||
|
||||
19
smart.cmake
19
smart.cmake
@@ -70,8 +70,9 @@ if( scalar( @c ) > 2 )
|
||||
}
|
||||
|
||||
$c[0] = uc( $c[0] );
|
||||
$request_method = $c[0];
|
||||
|
||||
if( $c[0] eq 'POST' )
|
||||
if( $request_method eq 'POST' )
|
||||
{
|
||||
my $content_length = 0;
|
||||
|
||||
@@ -86,7 +87,7 @@ if( $c[0] eq 'POST' )
|
||||
}
|
||||
}
|
||||
|
||||
if( $c[0] ne 'GET' && $c[0] ne 'POST' )
|
||||
if( $request_method ne 'GET' && $request_method ne 'POST' )
|
||||
{
|
||||
error( 501 );
|
||||
}
|
||||
@@ -97,7 +98,7 @@ $cc =~ s/[^\?]*\?//;
|
||||
$c = substr( shift( @p ), 1 );
|
||||
|
||||
parse_params( $p[0] );
|
||||
parse_params( $post_body ) if $c[0] eq 'POST';
|
||||
parse_params( $post_body ) if $request_method eq 'POST';
|
||||
|
||||
@c = split( '/', $c );
|
||||
|
||||
@@ -416,7 +417,7 @@ html,body{margin:0;padding:0;min-height:100%;background:var(--bg);color:var(--te
|
||||
body{display:flex;align-items:center;justify-content:center;padding:24px}
|
||||
.login{width:min(440px,100%);background:var(--panel);border:1px solid var(--line);border-radius:20px;box-shadow:0 18px 45px rgba(64,36,12,.12);overflow:hidden}
|
||||
.hero{padding:26px 28px;background:linear-gradient(135deg,#a80f18,#c44731 60%,#d79a54);color:white}
|
||||
.hero h1{margin:0;font-size:28px}
|
||||
.hero{display:flex;align-items:center;gap:16px}.hero img{width:54px;height:auto;background:#fff;border-radius:12px;padding:6px;box-shadow:0 8px 20px rgba(0,0,0,.16)}.hero h1{margin:0;font-size:28px}
|
||||
.hero p{margin:6px 0 0;opacity:.95}
|
||||
form{padding:24px 28px 28px}
|
||||
label{display:block;font-weight:bold;margin:0 0 7px}
|
||||
@@ -429,8 +430,11 @@ button{width:100%;border:1px solid #a33d2f;border-radius:12px;padding:11px 14px;
|
||||
<body>
|
||||
<div class="login">
|
||||
<div class="hero">
|
||||
<h1>SMArT Login</h1>
|
||||
<p>MARS_NWE web administration</p>
|
||||
<img src="/static/smart_icon.jpg" alt="SMArT logo">
|
||||
<div>
|
||||
<h1>SMArT Login</h1>
|
||||
<p>MARS_NWE web administration</p>
|
||||
</div>
|
||||
</div>
|
||||
<form method="POST" action="/login">
|
||||
EOF
|
||||
@@ -446,7 +450,6 @@ EOF
|
||||
<label for="pass">Password</label>
|
||||
<input id="pass" name="pass" type="password" autocomplete="current-password" autofocus>
|
||||
<button type="submit">Login</button>
|
||||
<div class="note">Authentication is checked through PAM via <tt>check_login</tt>.</div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
@@ -456,7 +459,7 @@ EOF
|
||||
|
||||
sub handle_login_route()
|
||||
{
|
||||
if( $c[0] ne 'POST' )
|
||||
if( $request_method ne 'POST' )
|
||||
{
|
||||
print_login_page( '' );
|
||||
return;
|
||||
|
||||
@@ -19,7 +19,7 @@ body{padding:18px}
|
||||
a{color:inherit} code,tt{font-family:"DejaVu Sans Mono",monospace}
|
||||
.shell{max-width:1250px;margin:0 auto}
|
||||
.hero{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:22px 24px;border:1px solid var(--line);border-radius:18px;background:linear-gradient(135deg,#a80f18,#c44731 60%,#d79a54);color:#fff;box-shadow:0 12px 30px rgba(64,36,12,.08)}
|
||||
.hero img{height:42px;width:auto;display:block;background:#fff;border-radius:10px;padding:5px;box-shadow:0 8px 20px rgba(0,0,0,.12)}
|
||||
.hero-actions{display:flex;align-items:center;gap:12px}.hero img{height:42px;width:auto;display:block;background:#fff;border-radius:10px;padding:5px;box-shadow:0 8px 20px rgba(0,0,0,.12)}.logout-button{display:inline-block;text-decoration:none;border:1px solid rgba(255,255,255,.6);border-radius:10px;padding:8px 13px;background:rgba(255,255,255,.14);color:#fff;font-weight:bold;box-shadow:0 8px 18px rgba(0,0,0,.10)}.logout-button:hover{background:rgba(255,255,255,.22)}
|
||||
.hero h1{margin:0;font-size:28px;line-height:1.1}
|
||||
.hero p{margin:6px 0 0;font-size:15px;opacity:.95}
|
||||
.workspace{margin-top:18px;display:grid;grid-template-columns:180px minmax(0,1fr);gap:18px;align-items:start}
|
||||
@@ -83,7 +83,7 @@ a{color:inherit} code,tt{font-family:"DejaVu Sans Mono",monospace}
|
||||
<h1>Main menu</h1>
|
||||
<p>Choose a section from the icon list. The explanation opens here on the left, and the editor opens on the right.</p>
|
||||
</div>
|
||||
<img src="/static/smart_icon.jpg" alt="SMArT logo">
|
||||
<div class="hero-actions"><a class="logout-button" href="/logout" target="_top">Logout</a><img src="/static/smart_icon.jpg" alt="SMArT logo"></div>
|
||||
</div>
|
||||
|
||||
<div class="workspace">
|
||||
|
||||
Reference in New Issue
Block a user