This commit is contained in:
a 2022-08-03 05:22:39 -05:00
parent 0dfd668894
commit 66ef125eff
3 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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).

View File

@ -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
}