mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-04 14:30:28 +00:00
#8868 add login button in header for guest user
This commit is contained in:
parent
b4583ef9c5
commit
b5c617866a
@ -50,6 +50,7 @@ exports.handler = function(request,response,state) {
|
||||
"user-is-admin": state.authenticatedUser && state.authenticatedUser.isAdmin ? "yes" : "no",
|
||||
"first-guest-user": state.firstGuestUser ? "yes" : "no",
|
||||
"show-anon-config": state.showAnonConfig ? "yes" : "no",
|
||||
"user-is-logged-in": !!state.authenticatedUser ? "yes" : "no",
|
||||
"user": JSON.stringify(state.authenticatedUser),
|
||||
"has-profile-access": !!state.authenticatedUser ? "yes" : "no"
|
||||
}});
|
||||
|
@ -91,6 +91,7 @@ exports.handler = function(request,response,state) {
|
||||
"username": state.authenticatedUser ? state.authenticatedUser.username : state.firstGuestUser ? "Anonymous User" : "Guest",
|
||||
"user-is-admin": state.authenticatedUser && state.authenticatedUser.isAdmin ? "yes" : "no",
|
||||
"user-id": user_id,
|
||||
"user-is-logged-in": !!state.authenticatedUser ? "yes" : "no",
|
||||
"has-profile-access": !!state.authenticatedUser ? "yes" : "no"
|
||||
}
|
||||
});
|
||||
|
@ -27,16 +27,25 @@ title: $:/plugins/tiddlywiki/multiwikiserver/templates/mws-header
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<% elseif [<has-profile-access>match[yes]] %>
|
||||
<$set name="userId" value={{{ [<user>jsonget[user_id]] }}}>
|
||||
<a href={{{ [<userId>addprefix[/admin/users/]] }}}>
|
||||
<button class="mws-profile-btn">Profile</button>
|
||||
</a>
|
||||
</$set>
|
||||
<% endif %>
|
||||
<form action="/logout" method="post" class="mws-logout-form">
|
||||
<input type="submit" value="Logout" class="mws-logout-button"/>
|
||||
</form>
|
||||
<% if [<user-is-logged-in>match[yes]] %>
|
||||
<%if [<first-guest-user>match[no]] %>
|
||||
<%if [<user-is-admin>match[no]] %>
|
||||
<$set name="userId" value={{{ [<user>jsonget[user_id]] }}}>
|
||||
<a href={{{ [<userId>addprefix[/admin/users/]] }}}>
|
||||
<button class="mws-profile-btn">Profile</button>
|
||||
</a>
|
||||
</$set>
|
||||
<% endif %>
|
||||
<% endif %>
|
||||
<% endif %>
|
||||
<% if [<user-is-logged-in>match[yes]] %>
|
||||
<form action="/logout" method="post" class="mws-logout-form">
|
||||
<input type="submit" value="Logout" class="mws-logout-button"/>
|
||||
</form>
|
||||
<% else %>
|
||||
<a class="mws-login-btn" href="/login">Login</a>
|
||||
<% endif %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -82,6 +91,25 @@ title: $:/plugins/tiddlywiki/multiwikiserver/templates/mws-header
|
||||
background-color: #d32f2f;
|
||||
}
|
||||
|
||||
.mws-login-btn {
|
||||
margin-left: 5px;
|
||||
background-color: #4caf50;
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
height: 27px;
|
||||
width: 62px;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.mws-login-btn:hover {
|
||||
background-color: #388e3c;
|
||||
}
|
||||
|
||||
.mws-admin-dropdown {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
Loading…
Reference in New Issue
Block a user