Commit 27fc20d4 authored by Lucas Brown's avatar Lucas Brown

Updated virtual login functionality and top navbar when not authenicated.

parent 0471af92
......@@ -131,7 +131,6 @@ func (h *Examples) Images(ctx context.Context, w http.ResponseWriter, r *http.Re
// List of image sizes that will be used to resize the source image into. The resulting images will then be included
// as apart of the image src tag for a responsive image tag.
data := map[string]interface{}{
"imgSizes": []int{100, 200, 300, 400, 500},
"imgResizeDisabled": false,
}
......
......@@ -36,6 +36,10 @@ type User struct {
SecretKey string
}
func urlUserVirtualLogin(userID string) string {
return fmt.Sprintf("/user/virtual-login/%s", userID)
}
// UserLoginRequest extends the AuthenicateRequest with the RememberMe flag.
type UserLoginRequest struct {
user_auth.AuthenticateRequest
......
......@@ -369,6 +369,7 @@ func (h *Users) View(ctx context.Context, w http.ResponseWriter, r *http.Request
}
data["urlUsersUpdate"] = urlUsersUpdate(userID)
data["urlUserVirtualLogin"] = urlUserVirtualLogin(userID)
return h.Renderer.Render(ctx, w, r, TmplLayoutBase, "users-view.gohtml", web.MIMETextHTMLCharsetUTF8, http.StatusOK, data)
}
......
......@@ -814,7 +814,7 @@ func main() {
tmplFuncs["S3ImgThumbSrcSmall"] = func(ctx context.Context, p string) template.HTMLAttr {
return imgSrcAttr(ctx, p, []int{320}, false)
}
tmplFuncs["S3ImgSrc"] = func(ctx context.Context, p string, sizes []int) template.HTMLAttr {
tmplFuncs["S3ImgSrc"] = func(ctx context.Context, p string, sizes ...int) template.HTMLAttr {
return imgSrcAttr(ctx, p, sizes, true)
}
tmplFuncs["S3ImgUrl"] = func(ctx context.Context, p string, size int) string {
......
......@@ -109,3 +109,12 @@ div.dataTable_card a.paginate_button.current {
.alert p:last-child {
margin-bottom: 0;
}
.topbar.navbar-light .navbar-nav.unauthenicated .nav-item .nav-link {
color: #4e73df;
}
.topbar.navbar-light .navbar-nav.unauthenicated .nav-item .nav-link:hover {
color: #1cc88a;
}
......@@ -4,7 +4,9 @@
{{end}}
{{define "content"}}
<h3>Inline Validation Example</h3>
<h3 class="mt-5">Inline Validation Example</h3>
<p>Any field error that is not displayed inline will still be displayed as apart of the the validation at the top of the page.</p>
<form class="user" method="post" novalidate>
<div class="form-group">
......@@ -12,7 +14,7 @@
{{template "invalid-feedback" dict "validationDefaults" $.validationDefaults "validationErrors" $.validationErrors "fieldName" "Email" }}
</div>
<button class="btn btn-primary btn-user btn-block">
<button class="btn btn-purple btn-user ">
Submit Form
</button>
<hr>
......
......@@ -22,35 +22,31 @@
<div class="text-center">
<h1 class="h4 text-gray-900 mb-2">Reset Your Password</h1>
<p class="mb-4">.....</p>
<p class="mb-4">Enter your new password below.</p>
</div>
{{ template "validation-error" . }}
<form class="user" method="post" novalidate>
<input type="hidden" name="ResetHash" value="{{ $.form.ResetHash }}" />
<div class="form-group row">
<div class="col-sm-6 mb-3 mb-sm-0">
<input type="password" class="form-control form-control-user {{ ValidationFieldClass $.validationErrors "Password" }}" name="Password" value="{{ $.form.Password }}" placeholder="Password" required>
<div class="form-group ">
<input type="password" class="form-control form-control-user {{ ValidationFieldClass $.validationErrors "Password" }}" name="Password" value="{{ $.form.Password }}" placeholder="New Password" required>
{{template "invalid-feedback" dict "validationDefaults" $.validationDefaults "validationErrors" $.validationErrors "fieldName" "Password" }}
</div>
<div class="col-sm-6">
<input type="password" class="form-control form-control-user {{ ValidationFieldClass $.validationErrors "PasswordConfirm" }}" name="PasswordConfirm" value="{{ $.form.PasswordConfirm }}" placeholder="Repeat Password" required>
</div>
<div class="form-group ">
<input type="password" class="form-control form-control-user {{ ValidationFieldClass $.validationErrors "PasswordConfirm" }}" name="PasswordConfirm" value="{{ $.form.PasswordConfirm }}" placeholder="Repeat New Password" required>
{{template "invalid-feedback" dict "validationDefaults" $.validationDefaults "validationErrors" $.validationErrors "fieldName" "PasswordConfirm" }}
</div>
</div>
<button class="btn btn-primary btn-user btn-block">
Reset Password
</button>
<hr>
</form>
<hr>
<div class="text-center">
<a class="small" href="/user/login">Already have an account? Login!</a>
</div>
<div class="text-center">
<a class="small" href="/signup">Create an Account!</a>
</div>
</div>
</div>
</div>
......
......@@ -26,6 +26,10 @@
{{ $ctxUser := ContextUser $._Ctx }}
{{ if $ctxUser }}
{{ if ne .user.ID $ctxUser.ID }}
<a href="{{ .urlUserVirtualLogin }}" class="dropdown-item">Virtual Login</a>
<form method="post"><input type="hidden" name="action" value="archive" /><input type="submit" value="Archive User" class="dropdown-item"></form>
{{ end }}
{{ end }}
......
......@@ -178,12 +178,12 @@
Account Settings
</a>
<a class="dropdown-item" href="/users">
<i class="fas fa-cogs fa-sm fa-fw mr-2 text-gray-400"></i>
<i class="fas fa-users fa-sm fa-fw mr-2 text-gray-400"></i>
Manage Users
</a>
<a class="dropdown-item" href="/users/invite">
<i class="fas fa-cogs fa-sm fa-fw mr-2 text-gray-400"></i>
Invite User
<i class="fas fa-user-plus fa-sm fa-fw mr-2 text-gray-400"></i>
Invite Users
</a>
{{ else }}
<a class="dropdown-item" href="/user/account">
......@@ -193,7 +193,7 @@
{{ end }}
<a class="dropdown-item" href="/support" target="_blank">
<i class="fas fa-cogs fa-sm fa-fw mr-2 text-gray-400"></i>
<i class="fas fa-hand-holding-heart fa-sm fa-fw mr-2 text-gray-400"></i>
Support
</a>
<div class="dropdown-divider"></div>
......@@ -207,7 +207,7 @@
{{ if ContextIsVirtualSession $._Ctx }}
<a class="dropdown-item" href="/user/virtual-logout">
<i class="far fa-sign-out fa-sm fa-fw mr-2 text-gray-400"></i>
<i class="fas fa-undo-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Switch Back
</a>
{{ end }}
......@@ -221,7 +221,19 @@
</ul>
{{ else }}
<button onclick="window.location='/user/login'; return false;">Login</button>
<ul class="navbar-nav ml-auto unauthenicated">
<li class="nav-item">
<a class="nav-link" href="/signup">Create Account</a>
</li>
<div class="topbar-divider d-none d-sm-block"></div>
<li class="nav-item">
<a class="nav-link" href="/user/login"><i class="fas fa-unlock-alt mr-1"></i>Login</a>
</li>
</ul>
{{ end }}
</nav>
<!-- End of Topbar -->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment