Creating backend to handler password resets
This commit is contained in:
		@ -280,3 +280,16 @@ func (m *DBModel) Authenticate(email, password string) (int, error) {
 | 
			
		||||
 | 
			
		||||
	return id, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *DBModel) UpdatePasswordForUser(u User, hash string) error {
 | 
			
		||||
	ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
 | 
			
		||||
	defer cancel()
 | 
			
		||||
 | 
			
		||||
	stmt := `UPDATE users SET password = ? where id = ?`
 | 
			
		||||
 | 
			
		||||
	_, err := m.DB.ExecContext(ctx, stmt, hash, u.ID)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user