This commit is contained in:
parent
0dfd668894
commit
66ef125eff
|
@ -391,7 +391,7 @@ func (s *Server) loginHandlerPost(w http.ResponseWriter, r *http.Request) {
|
|||
password := r.FormValue("password")
|
||||
email_escaped := html.EscapeString(email)
|
||||
|
||||
hashedPassword, err := s.store.HasAccount(r.Context(), email_escaped)
|
||||
hashedPassword, err := s.store.GetAccount(r.Context(), email_escaped)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
|
@ -471,7 +471,7 @@ func (s *Server) registerHandlerPost(w http.ResponseWriter, r *http.Request) {
|
|||
email := r.FormValue("email")
|
||||
pass := r.FormValue("password")
|
||||
email_escaped := html.EscapeString(email)
|
||||
bts, err := s.store.HasAccount(r.Context(), email_escaped)
|
||||
bts, err := s.store.GetAccount(r.Context(), email_escaped)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
|
|
|
@ -316,7 +316,7 @@ func (s *Sqlike) DelPaste(ctx context.Context, pasteId, delKey string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *Sqlike) HasAccount(ctx context.Context, email string) ([]byte, error) {
|
||||
func (s *Sqlike) GetAccount(ctx context.Context, email string) ([]byte, error) {
|
||||
var hashedPassword []byte
|
||||
err := s.handle.QueryRowContext(ctx, "select password from "+s.config.DBAccountsTable+
|
||||
" where email="+s.config.DBPlaceHolder[0], email).
|
||||
|
|
|
@ -34,6 +34,6 @@ type Store interface {
|
|||
ForceDelPaste(ctx context.Context, pasteId string) error
|
||||
DelPaste(ctx context.Context, pasteId, delKey string) error
|
||||
|
||||
HasAccount(ctx context.Context, email string) ([]byte, error)
|
||||
GetAccount(ctx context.Context, email string) ([]byte, error)
|
||||
RegisterUser(ctx context.Context, email string, hashpass []byte) error
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue