Add security page
This commit is contained in:
@@ -18,11 +18,9 @@
|
||||
<li class="nav-item {{ if eq .activeNav "profile" }}active{{ end }}">
|
||||
<a class="nav-link" href="{{ links.Profile }}">Your profile</a>
|
||||
</li>
|
||||
{{ if .settings.LocalEnabled }}
|
||||
<li class="nav-item {{ if eq .activeNav "security" }}active{{ end }}">
|
||||
<a class="nav-link" href="{{ links.ChangePassword }}">Security</a>
|
||||
<a class="nav-link" href="{{ links.Security }}">Security</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
<li class="nav-item {{ if eq .activeNav "sessions" }}active{{ end }}">
|
||||
<a class="nav-link" href="{{ links.Sessions }}">Login sessions</a>
|
||||
</li>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{{ template "inc_header.html.tpl" set . "activeNav" "security" }}
|
||||
<div class="card-body p-0">
|
||||
<h4 class="card-title p-3 border-bottom">Security</h4>
|
||||
<ul>
|
||||
{{ if .settings.LocalEnabled }}
|
||||
<li><a href="{{ links.ChangePassword }}">Change your password</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{ template "inc_footer.html.tpl" . }}
|
||||
@@ -0,0 +1,10 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"github.com/cortezaproject/corteza-server/auth/request"
|
||||
)
|
||||
|
||||
func (h *AuthHandlers) security(req *request.AuthReq) error {
|
||||
req.Template = TmplSecurity
|
||||
return nil
|
||||
}
|
||||
@@ -84,6 +84,7 @@ const (
|
||||
TmplRequestPasswordReset = "request-password-reset.html.tpl"
|
||||
TmplPasswordResetRequested = "password-reset-requested.html.tpl"
|
||||
TmplResetPassword = "reset-password.html.tpl"
|
||||
TmplSecurity = "security.html.tpl"
|
||||
TmplProfile = "profile.html.tpl"
|
||||
TmplSessions = "sessions.html.tpl"
|
||||
TmplSignup = "signup.html.tpl"
|
||||
|
||||
@@ -7,7 +7,10 @@ type (
|
||||
ConfirmEmail,
|
||||
PendingEmailConfirmation,
|
||||
Login,
|
||||
|
||||
Security,
|
||||
ChangePassword,
|
||||
|
||||
RequestPasswordReset,
|
||||
PasswordResetRequested,
|
||||
ResetPassword,
|
||||
@@ -34,6 +37,7 @@ func GetLinks() Links {
|
||||
ConfirmEmail: "/auth/confirm-email",
|
||||
PendingEmailConfirmation: "/auth/pending-email-confirmation",
|
||||
Login: "/auth/login",
|
||||
Security: "/auth/security",
|
||||
ChangePassword: "/auth/change-password",
|
||||
RequestPasswordReset: "/auth/request-password-reset",
|
||||
PasswordResetRequested: "/auth/password-reset-requested",
|
||||
|
||||
@@ -69,6 +69,7 @@ func (h *AuthHandlers) MountHttpRoutes(r chi.Router) {
|
||||
r.Get(l.ResetPassword, h.handle(h.onlyIfPasswordResetEnabled(h.resetPasswordForm)))
|
||||
r.Post(l.ResetPassword, h.handle(h.onlyIfPasswordResetEnabled(authOnly(h.resetPasswordProc))))
|
||||
|
||||
r.Get(l.Security, h.handle(authOnly(h.security)))
|
||||
r.Get(l.ChangePassword, h.handle(h.onlyIfLocalEnabled(authOnly(h.changePasswordForm))))
|
||||
r.Post(l.ChangePassword, h.handle(h.onlyIfLocalEnabled(authOnly(h.changePasswordProc))))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user