l10n, create dir on creating file
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
)
|
||||
|
||||
type AuthStore interface {
|
||||
Get(user string) bool
|
||||
Register(user, pass string) error
|
||||
Login(user, pass string) (token string, err error)
|
||||
Verify(token string) (session Session, err error)
|
||||
@@ -39,6 +40,11 @@ func New(path string, hashKey []byte) (AuthStore, error) {
|
||||
return s, err
|
||||
}
|
||||
|
||||
func (s Htpasswd) Get(user string) bool {
|
||||
_, ok := s.accounts[user]
|
||||
return ok
|
||||
}
|
||||
|
||||
func (s Htpasswd) Register(user, pass string) (err error) {
|
||||
if _, ok := s.accounts[user]; ok {
|
||||
return errors.New("user already exists")
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
{{ define "title" }}Sign Up{{ end }}
|
||||
{{ define "title" }}登入{{ end }}
|
||||
{{ define "main" }}
|
||||
<h1>Sign In</h1>
|
||||
<h1>登入</h1>
|
||||
<form action="/signin" method="POST">
|
||||
<label>Email: <input type="text" name="email"></label><br>
|
||||
<label>Password: <input type="password" name="password"></label><br>
|
||||
{{ with .Error }}<p class="error">{{ . }}</p>{{ end }}
|
||||
<input type="submit" value="Sign Up">
|
||||
<input type="submit" value="登入">
|
||||
</form>
|
||||
<a href="signup">沒有帳號嗎?註冊</a>
|
||||
{{ end }}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
{{ define "title" }}Sign Up{{ end }}
|
||||
{{ define "title" }}註冊{{ end }}
|
||||
{{ define "main" }}
|
||||
<h1>Sign Up</h1>
|
||||
<h1>註冊</h1>
|
||||
<form action="/signup" method="POST">
|
||||
<label>Email: <input type="text" name="email"></label><br>
|
||||
<label>Password: <input type="password" name="password"></label><br>
|
||||
{{ with .Error }}<p class="error">{{ . }}</p>{{ end }}
|
||||
<input type="submit" value="Sign Up">
|
||||
<input type="submit" value="註冊">
|
||||
</form>
|
||||
<a href="signin">已有帳號嗎?登入</a>
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user