openidec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 7d6cbb769694439504a4ab5dfb34989048c326ec
parent 044613bff5b965be817d7c87f5e2740bd8190489
Author: Peter Kosyh <p.kosyh@gmail.com>
Date:   Sat,  5 Sep 2020 11:16:58 +0300

templates fix

Diffstat:
Mii-node/lib/style.css | 9++++++---
Mii-node/tpl/login.tpl | 2+-
Mii-node/tpl/new.tpl | 2+-
Mii-node/tpl/register.tpl | 2+-
Mii/db.go | 9++++++++-
5 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/ii-node/lib/style.css b/ii-node/lib/style.css @@ -125,19 +125,22 @@ margin-top: 1em; background: #ffffea; border: 1px solid #55aaaa; -// box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26); } + #edit textarea, #edit input { font-size: larger; - background-color: #ffffea; - margin: 0.5em; + margin: 10px; + padding: 10px; border: none; overflow: auto; width: 95%; + border: 1px solid #55aaaa; } #edit textarea { + background-color: #ffffea; min-height: 20em; + font-size: x-large; } #topic .selected { diff --git a/ii-node/tpl/login.tpl b/ii-node/tpl/login.tpl @@ -11,7 +11,7 @@ <input type="password" name="password" class="passwd" placeholder="password"> </td></tr> -<tr class="odd"><td class="links" colspan="2"> +<tr class="odd"><td class="links"> <button class="form-button">Login</button> </td></tr> diff --git a/ii-node/tpl/new.tpl b/ii-node/tpl/new.tpl @@ -1,7 +1,7 @@ {{template "header.tpl" $}} <table id="edit"> <form method="post" enctype="application/x-www-form-urlencoded" action="/{{.Echo}}/new"> -<tr><td class="even"> +<tr><td class="odd"> <input type="text" name="to" class="to" placeholder="To" value="All"><br> <input type="text" name="subj" class="subj" placeholder="Subject"><br> <textarea type="text" name="msg" class="message" cols=60 row=16 placeholder="Hi, All!"> diff --git a/ii-node/tpl/register.tpl b/ii-node/tpl/register.tpl @@ -14,7 +14,7 @@ <input type="text" name="email" class="email" placeholder="email"> </td></tr> -<tr class="even"><td class="links" colspan="2"> +<tr class="even"><td class="links"> <button class="form-button">Register</button> </td></tr> diff --git a/ii/db.go b/ii/db.go @@ -600,7 +600,11 @@ type UDB struct { } func IsUsername(u string) bool { - return !strings.ContainsAny(u, ":\n \r\t") && len(u) <= 16 + return !strings.ContainsAny(u, ":\n \r\t") && len(u) <= 16 && len(u) > 2 +} + +func IsPassword(u string) bool { + return len(u) >= 1 } func MakeSecret(msg string) string { @@ -674,6 +678,9 @@ func (db *UDB) Add(Name string, Mail string, Passwd string) error { if !IsUsername(Name) { return errors.New("Wrong username") } + if !IsPassword(Passwd) { + return errors.New("Bad password") + } if !emailRegex.MatchString(Mail) { return errors.New("Wrong email") }