⚡️ Implemented login management
This commit is contained in:
@@ -1,92 +1,94 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ShareDAV</title>
|
||||
<style>
|
||||
thead {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input[type="submit"],
|
||||
input[type="button"] {
|
||||
padding: .5em;
|
||||
border-radius: .5em;
|
||||
border: 0;
|
||||
background-color: #c4e1ff;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input[type="submit"].delete {
|
||||
background-color: #e56f83;
|
||||
}
|
||||
|
||||
input[type="submit"] {
|
||||
background-color: #a9ca97;
|
||||
}
|
||||
|
||||
a:before {
|
||||
content: "› ";
|
||||
color: gray;
|
||||
}
|
||||
|
||||
a, a:visited, a:hover, a:active, a:focus {
|
||||
/* font-style: normal; */
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
|
||||
#content {
|
||||
float: right;
|
||||
width: calc(100% - 20px);
|
||||
/* background-color: #F0F0F0; */
|
||||
/* border-radius: 1em; */
|
||||
/* padding: 10px; */
|
||||
/* height: calc(100vh - 40px);*/
|
||||
}
|
||||
|
||||
#menu {
|
||||
float: left;
|
||||
width: 150px;
|
||||
margin-left: -185px;
|
||||
background-color: #CCCCCC;
|
||||
border-radius: .5em;
|
||||
padding: 10px;
|
||||
height: calc(100vh - 40px);
|
||||
}
|
||||
|
||||
#menu span {
|
||||
display: block;
|
||||
margin-bottom: .5em;
|
||||
}
|
||||
|
||||
#menu hr {
|
||||
border: 1px solid gray;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin-left: 200px
|
||||
}
|
||||
</style>
|
||||
{{ block "page-styles" . }}{{ end }}
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
{{ block "page-content" . }}{{ end }}
|
||||
</div>
|
||||
<div id="menu">
|
||||
<span style="font-weight: bold;"><a href="./">ShareDAV</a></span>
|
||||
{{ if .SessionUser }}
|
||||
{{ if eq .SessionUser.Role "admin" }}
|
||||
<hr/>
|
||||
<span><a href="users">Users</a></span>
|
||||
<span><a href="shares">Shares</a></span>
|
||||
{{ end }}
|
||||
<hr/>
|
||||
<span><a href="logout">Logout</a></span>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
</body>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ShareDAV</title>
|
||||
<style>
|
||||
thead {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input[type="submit"],
|
||||
input[type="button"] {
|
||||
padding: .5em;
|
||||
border-radius: .5em;
|
||||
border: 0;
|
||||
background-color: #c4e1ff;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input[type="submit"].delete {
|
||||
background-color: #e56f83;
|
||||
}
|
||||
|
||||
input[type="submit"] {
|
||||
background-color: #a9ca97;
|
||||
}
|
||||
|
||||
a:before {
|
||||
content: "› ";
|
||||
color: gray;
|
||||
}
|
||||
|
||||
a, a:visited, a:hover, a:active, a:focus {
|
||||
/* font-style: normal; */
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
|
||||
#content {
|
||||
float: right;
|
||||
width: calc(100% - 20px);
|
||||
/* background-color: #F0F0F0; */
|
||||
/* border-radius: 1em; */
|
||||
/* padding: 10px; */
|
||||
/* height: calc(100vh - 40px);*/
|
||||
}
|
||||
|
||||
#menu {
|
||||
float: left;
|
||||
width: 150px;
|
||||
margin-left: -185px;
|
||||
background-color: #CCCCCC;
|
||||
border-radius: .5em;
|
||||
padding: 10px;
|
||||
height: calc(100vh - 40px);
|
||||
}
|
||||
|
||||
#menu span {
|
||||
display: block;
|
||||
margin-bottom: .5em;
|
||||
}
|
||||
|
||||
#menu hr {
|
||||
border: 1px solid gray;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin-left: 200px
|
||||
}
|
||||
</style>
|
||||
{{ block "page-styles" . }}{{ end }}
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
{{ block "page-content" . }}{{ end }}
|
||||
</div>
|
||||
<div id="menu">
|
||||
<span style="font-weight: bold;"><a href="./">ShareDAV</a></span>
|
||||
{{ if .SessionUser }}
|
||||
{{ if eq .SessionUser.Role "admin" }}
|
||||
<hr/>
|
||||
<span><a href="users">Users</a></span>
|
||||
<span><a href="shares">Shares</a></span>
|
||||
{{ end }}
|
||||
<hr/>
|
||||
<span><a href="my-shares">My Shares</a></span>
|
||||
<hr/>
|
||||
<span><a href="logout">Logout</a></span>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
</body>
|
||||
</html>
|
||||
67
templates/my-shares.html
Normal file
67
templates/my-shares.html
Normal file
@@ -0,0 +1,67 @@
|
||||
{{ define "page-styles"}}
|
||||
<style>
|
||||
div.share-user, div.share-login {
|
||||
margin-left: 2em;
|
||||
margin-top: .5em;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
a.share-add-user, a.share-add-login {
|
||||
margin-left: 2em;
|
||||
margin-top: .5em;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
div.share {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
:target {
|
||||
background-color: #c4e1ff;
|
||||
}
|
||||
</style>
|
||||
{{ end }}
|
||||
|
||||
{{ define "page-content" }}
|
||||
<div id="shares">
|
||||
{{ range $share := .ShareInfos }}
|
||||
<div id="share-{{$share.UUID}}" class="share">
|
||||
UUID: {{ $share.UUID }} {{ if $share.IsAdmin }}
|
||||
<form style="display: inline-block;" action="delete-share" method="post">
|
||||
<input type="hidden" name="share" value="{{ $share.UUID }}"/>
|
||||
<input type="submit" value="Delete" class="delete"/>
|
||||
</form>{{ end }}
|
||||
<br/>
|
||||
Name: {{ $share.Name }}<br/>
|
||||
<hr/>
|
||||
{{ range $login := .Logins }}
|
||||
<div id="login-{{$share.UUID}}-{{$login.LoginName}}" class="share-login">
|
||||
Login {{ $login.LoginName }} {{ if $login.ReadOnly }}(ReadOnly){{ end }}
|
||||
<form style="display: inline-block;" action="share-delete-login" method="post">
|
||||
<input type="hidden" name="share" value="{{ $share.UUID }}"/>
|
||||
<input type="hidden" name="login" value="{{ $login.LoginName }}"/>
|
||||
<input type="submit" value="Delete" class="delete"/>
|
||||
</form>
|
||||
</div>
|
||||
{{ end }}
|
||||
<a href="share-add-login?share={{ $share.UUID }}" class="share-add-login">Add Login</a>
|
||||
<hr/>
|
||||
{{ if $share.IsAdmin }}
|
||||
{{ range $user := .Users }}
|
||||
<div id="user-{{$share.UUID}}-{{$user.Username}}" class="share-user">
|
||||
User {{ $user.Username }} ({{ $user.Role }})
|
||||
<form style="display: inline-block;" action="share-delete-user" method="post">
|
||||
<input type="hidden" name="source" value="my-shares"/>
|
||||
<input type="hidden" name="share" value="{{ $share.UUID }}"/>
|
||||
<input type="hidden" name="user" value="{{ $user.Username }}"/>
|
||||
<input type="submit" value="Delete" class="delete"/>
|
||||
</form>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<a href="share-add-user?share={{ $share.UUID }}" class="share-add-user">Add User</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
<a href="create-share" class="create-share">Create Share</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
15
templates/share-add-login.html
Normal file
15
templates/share-add-login.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{{ define "page-content" }}
|
||||
<form method="post">
|
||||
<input name="share" type="hidden" value="{{ .ShareId }}"/>
|
||||
<label>
|
||||
Login: <input name="login" placeholder="Login name"/>
|
||||
</label>
|
||||
<label>
|
||||
Password: <input type="password" name="password" placeholder="Password"/>
|
||||
</label>
|
||||
<label>
|
||||
ReadOnly: <input type="checkbox" name="readonly"/>
|
||||
</label>
|
||||
<input type="submit" value="Add Login"/>
|
||||
</form>
|
||||
{{ end }}
|
||||
@@ -1,47 +1,52 @@
|
||||
{{ define "page-styles"}}
|
||||
<style>
|
||||
div.share-user {
|
||||
margin-left: 2em;
|
||||
margin-top: .5em;
|
||||
font-style: italic;
|
||||
}
|
||||
a.share-add-user {
|
||||
margin-left: 2em;
|
||||
margin-top: .5em;
|
||||
font-style: italic;
|
||||
}
|
||||
div.share {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
:target {
|
||||
background-color: #c4e1ff;
|
||||
}
|
||||
</style>
|
||||
{{ end }}
|
||||
|
||||
{{ define "page-content" }}
|
||||
<div id="shares">
|
||||
{{ range $share := .ShareInfos }}
|
||||
<div id="share-{{$share.UUID}}" class="share">
|
||||
UUID: {{ $share.UUID }} <form style="display: inline-block;" action="delete-share" method="post">
|
||||
<input type="hidden" name="share" value="{{ $share.UUID }}"/>
|
||||
<input type="submit" value="Delete" class="delete"/>
|
||||
</form>
|
||||
<br/>
|
||||
Name: {{ $share.Name }}<br/>
|
||||
{{ range $user := .Users }}
|
||||
<div id="user-{{$share.UUID}}-{{$user.Username}}" class="share-user">
|
||||
User {{ $user.Username }} ({{ $user.Role }})
|
||||
<form style="display: inline-block;" action="share-delete-user" method="post">
|
||||
<input type="hidden" name="share" value="{{ $share.UUID }}"/>
|
||||
<input type="hidden" name="user" value="{{ $user.Username }}"/>
|
||||
<input type="submit" value="Delete" class="delete"/>
|
||||
</form>
|
||||
</div>
|
||||
{{ end }}
|
||||
<a href="share-add-user?share={{ $share.UUID }}" class="share-add-user">Add User</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
<a href="create-share" class="create-share">Create Share</a>
|
||||
</div>
|
||||
{{ define "page-styles"}}
|
||||
<style>
|
||||
div.share-user {
|
||||
margin-left: 2em;
|
||||
margin-top: .5em;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
a.share-add-user {
|
||||
margin-left: 2em;
|
||||
margin-top: .5em;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
div.share {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
:target {
|
||||
background-color: #c4e1ff;
|
||||
}
|
||||
</style>
|
||||
{{ end }}
|
||||
|
||||
{{ define "page-content" }}
|
||||
<div id="shares">
|
||||
{{ range $share := .ShareInfos }}
|
||||
<div id="share-{{$share.UUID}}" class="share">
|
||||
UUID: {{ $share.UUID }}
|
||||
<form style="display: inline-block;" action="delete-share" method="post">
|
||||
<input type="hidden" name="share" value="{{ $share.UUID }}"/>
|
||||
<input type="submit" value="Delete" class="delete"/>
|
||||
</form>
|
||||
<br/>
|
||||
Name: {{ $share.Name }}<br/>
|
||||
{{ range $user := .Users }}
|
||||
<div id="user-{{$share.UUID}}-{{$user.Username}}" class="share-user">
|
||||
User {{ $user.Username }} ({{ $user.Role }})
|
||||
<form style="display: inline-block;" action="share-delete-user" method="post">
|
||||
<input type="hidden" name="source" value="shares"/>
|
||||
<input type="hidden" name="share" value="{{ $share.UUID }}"/>
|
||||
<input type="hidden" name="user" value="{{ $user.Username }}"/>
|
||||
<input type="submit" value="Delete" class="delete"/>
|
||||
</form>
|
||||
</div>
|
||||
{{ end }}
|
||||
<a href="share-add-user?share={{ $share.UUID }}" class="share-add-user">Add User</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
<a href="create-share" class="create-share">Create Share</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user