From ac1ee887205d068b7b1c1df690f157dda506e419 Mon Sep 17 00:00:00 2001 From: Horus3 Date: Mon, 23 Mar 2015 16:22:21 +0100 Subject: Reorder and restyle alert messages. Fixed bug in AuthUser(). Remove some unnecessary CSS. --- handler.go | 2 -- server.go | 6 +++++- static/css/style.css | 51 ++++++++------------------------------------------- user.go | 3 +++ views/about.html | 25 +------------------------ views/alert.html | 24 ++++++++++++++++++++++++ views/footer.html | 8 ++++++-- views/howto.html | 25 +------------------------ views/index.html | 25 +------------------------ views/login.html | 23 +++-------------------- views/password.html | 25 +------------------------ views/register.html | 25 +------------------------ views/server.html | 25 +------------------------ views/user.html | 24 +----------------------- 14 files changed, 56 insertions(+), 235 deletions(-) create mode 100644 views/alert.html diff --git a/handler.go b/handler.go index 4597ae3..c99138e 100644 --- a/handler.go +++ b/handler.go @@ -52,8 +52,6 @@ func RegisterHandler(w http.ResponseWriter, r *http.Request) { http.Error(w, err.Error(), http.StatusInternalServerError) return } - - session.Save(r, w) } func CreateNewEntryHandler(w http.ResponseWriter, r *http.Request) { diff --git a/server.go b/server.go index 9c20797..dc95c51 100644 --- a/server.go +++ b/server.go @@ -66,9 +66,13 @@ func ChangePassword(email, oldPassword, newPassword string) error { vU := VirtualUser{Email: email, Password: oldPassword} if !vU.AuthUser() { - return errors.New("User/password does not match.") + return errors.New("User/Password do not match.") } + vD := VirtualDomain{} + vD.Name = GetDomain(email) + vU.DomainId = vD.GetPrimaryKey() + if !vU.UpdatePassword(newPassword) { return errors.New("There was an error.") } diff --git a/static/css/style.css b/static/css/style.css index cc0e246..95942a9 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -1,3 +1,10 @@ +html { + position: relative; + min-height: 100%; +} +body { + margin-bottom: 100px; +} .navbar-default .navbar-brand { color: white; } @@ -14,48 +21,18 @@ } .alert { border-radius: 5px; -} - -.alert-success { - background-color: #d0e9c6 !important; - color: #473835; -} -.panel-danger > .panel-heading { - /* - background-color: #dd5148;*/ - color: #473835; - background-color: #ebcccc; -} -html { - position: relative; - min-height: 100%; -} -body { - margin-bottom: 100px; + color: white !important; } .delete { padding-top: 10%; } -.alert-danger { - background-color: #ebcccc; - color: #473835; -} -textarea { - box-shadow: 0 0px 10px rgba(0, 0, 0, 0.23), 0 0px 10px rgba(0, 0, 0, 0.16) !important; - background-color: #fff; - width: 100% !important; - height:200px !important; -} .hide { display: none ; } - .underline { text-decoration: underline; } - .shadow-y-2{box-shadow:0 -3px 10px rgba(0,0,0,.23),0 -3px 10px rgba(0,0,0,.16)} - .footer { position: absolute; bottom: 0; @@ -72,22 +49,10 @@ textarea { .footer-a { color: white; } - .footer-a:hover { color: white; text-decoration: underline; } -.admin-link { - position: absolute; - bottom: 50px; - color: #009587; - /* - margin-top: 0; - margin: 10px ; - top: 100%; - padding-bottom: 0; - */ -} .footer > .container { padding-left: 0; } diff --git a/user.go b/user.go index f491eea..9f5064e 100644 --- a/user.go +++ b/user.go @@ -9,6 +9,9 @@ func (vU VirtualUser) HashPassword() string { } func (vU VirtualUser) AuthUser() bool { + if !vU.EmailExists() { + return false + } passwd := vU.Password Db.Where("email = ?", vU.Email).Find(&vU) if vU.Password == passwd { diff --git a/views/about.html b/views/about.html index 2213ea3..13b73ab 100644 --- a/views/about.html +++ b/views/about.html @@ -1,29 +1,6 @@ {{template "header.html"}} {{template "navbar.html"}} - -{{if .Error}} -
- - {{.}} -
- {{end}} -- {{.}} -
- {{end}} -